The government has staked its political legitimacy on controlling the virus better than other countries, especially its geopolitical rivals.

The trip began in Shanghai, where the couple, both former professors, joined a tour group of other retirees. They traveled through Gansu Province and Inner Mongolia, staying at a bed-and-breakfast and eating three times at the same lamb chop restaurant. Flying south to Xi’an, they dropped in to a 1,300-year-old temple. Their fellow tour group members checked out an art museum, strolled through parks and visited friends.

Then, on Oct. 16, the day they had planned to visit the Terracotta Warriors, the couple tested positive for the coronavirus.

Since then, China has locked down a city of 4 million, as well as several smaller cities and parts of Beijing, to contain a fresh outbreak that has infected more than 240 people in at least 11 provinces and regions. The authorities have shuttered schools and tourist sites. Government websites have detailed every movement of the unlucky couple and their sprawling web of contacts, including what time they checked into hotels and on which floors of restaurants they sat.

The no-holds-barred response is emblematic of China’s “zero Covid” policy, which has served the country remarkably well: China has reported fewer than 5,000 deaths since the pandemic began. The scale of the new outbreak, while tiny compared to many other countries, is large for China.

“Every locality should firmly adhere to the policy of ‘Defend externally against importation, defend internally against rebound,’” Mi Feng, a spokesman for the National Health Commission, said at a news conference on Sunday. “The current control measures cannot be relaxed.”

The government’s strict strategy is the product of a uniquely Chinese set of calculations. Its thriving exports have helped to keep the economy afloat. The ruling Communist Party’s tight grip on power enables lockdowns and testing to be carried out with astonishing efficiency. Beijing is set to host the Winter Olympics in February.

For many Chinese, the low case numbers have become a source of national pride. Xi Jinping, China’s leader, has repeatedly pointed to the country’s success in containment as proof of the superiority of its governance model.

But experts — both in China and abroad — have warned that the approach is unsustainable. China may find itself increasingly isolated, diplomatically and economically, at a time when global public opinion is hardening against it.

“The regime thinks it needs to maintain a ‘zero Covid’ policy to maintain its legitimacy,” said Lynette Ong, a political scientist at the University of Toronto. “At a huge cost, though.”

In the early phase of the pandemic, the Chinese Communist Party’s very hold on power seemed to hinge on its ability to control the virus. Its initial attempts to cover up the outbreak in Wuhan gave rise to a stunning outpouring of public anger. Images of overwhelmed hospitals and patients begging for help flooded the Chinese internet.

As the virus barreled across the rest of the world, that narrative changed. China’s strict lockdowns and mass testing campaigns, once criticized as heavy handed, became models for other countries. As deaths mounted in western democracies, Mr. Xi repeatedly emphasized how quickly China had flattened its caseload. Outrage about the initial response to Wuhan gave way to at-times strident nationalism.

Other countries that adopted “zero Covid” policies were hailed as models of competent governance that prioritized saving lives over convenience and economic growth.

As the virus has dragged into its second year, and with the onset of the far more contagious Delta variant, countries are again reconsidering their strategies. Australia, which was home to the world’s longest lockdown, is scrapping quarantine requirements for vaccinated residents returning from overseas. New Zealand formally abandoned its quest for zero this month. Singapore is offering quarantine-free travel to vaccinated tourists from Germany, the United States, France and several other countries.