Following a four-month battle that saw millions of residents locked in their homes, extensive testing, and restrictions on daily life that impacted every aspect of society and the economy, China’s two largest cities have contained Covid-19.

Both the capital and the financial center recorded zero new locally transmitted Covid infections on Monday, the first time neither city had no virus freely circulating since Feb. 19. According to the National Health Commission, China reported only 22 cases nationwide.

The achievement in Beijing and Shanghai demonstrates that the virus can be eradicated despite the arrival of highly contagious omicron variants that can evade vaccination immunity.

However, the victory came at a high price, and the fight is far from over. New infections could emerge, restarting the containment cycle in either city. China has not been virus-free since October, but it is continuing with its intensive Covid Zero strategy.

Stopping the virus’s local spread necessitated harsh measures to eradicate infections and break transmission chains. More than 25 million residents in Shanghai, which last reported no new community cases on Feb. 23, were subjected to a two-month lockdown. Both cities have implemented targeted restrictions, extensive contact tracing, and regular testing.

The demands of Covid Zero demonstrate how difficult it is to eradicate the infectious pathogen for an extended period of time, as well as the risk that the world’s second largest economy faces. Many now expect Beijing to fall short of its 5.5 percent growth target for the year, with economists forecasting 4.2 percent GDP growth in 2022. The consequences are being felt all over the world, with Nike Inc. becoming the latest company to issue a bleak forecast based on dimming expectations in China.

Zero tolerance is isolating China from the rest of the world, which has become infected with the virus as a result of its shift to living with it. Nonetheless, Chinese authorities are under intense pressure to protect the economy from Covid Zero, particularly in the run-up to the Communist Party congress later this year, when President Xi Jinping is expected to win an unprecedented third term.

Local leaders are juggling efforts to keep Covid out while boosting their economies, and there is no end in sight. As their party chiefs, many of whom are close allies of Xi, addressed local party congresses in recent days, at least five key cities and provinces said virus control measures would be maintained.

Chen Min’er, the party boss of Chongqing, promised “no slack” in implementing Covid control measures. Li Hongzhong of Tianjin promised to normalize pandemic preparedness. While the Beijing Daily retracted a report that sparked a social media backlash for claiming that the capital would adopt a zero-tolerance policy “in the next five years,” it was based on comments from party leaders addressing the major tasks for the next five years.

Meanwhile, Shanghai’s leader declared victory in defending the financial hub against Covid-19, calling the city’s approach “completely correct.”

The majority of pandemic restrictions in Beijing, which reported zero cases on April 16, are set to be lifted, and students will be allowed to return to in-person school on Monday. However, there is a new normal.

To enter any public venue, including restaurants, shops, and public transportation, residents must show a green code on a mobile app that tracks their health status and take a Covid test every three days. Even children over the age of three must be tested before they can play in the park.

The virus is still circulating in other parts of the country.

Several cases have emerged in the technology hub Shenzhen, which is in the spotlight because Xi is expected to stay there later this week to commemorate the 25th anniversary of the Chinese takeover of Hong Kong. His presence is also expected at the inauguration of the city’s new chief executive, John Lee.

On Monday, five local infections were discovered in Shenzhen after the Futian district, which borders Hong Kong, was closed down, non-essential businesses were closed, and residents were restricted from leaving their compounds.

Tianjin, a northern port city, also reported four Covid infections on Monday. They were discovered during routine checks of employees working in a closed-loop system used for inbound international flights, according to state media.