Chinese leader Xi Jinping went on a carefully choreographed victory lap around Wuhan on Tuesday, lauding the dedication and tenacity of the Communist Party, health-care workers and ordinary people in defeating a coronavirus he had labeled a “devil.”

His first visit to Wuhan, the epicenter of the novel coronavirus outbreak, comes as the number of new infections in the country has plummeted and was designed to show the success of China’s response — and contrast them favorably against international efforts, analysts said.

“Now things are getting better and he wants to show that his leadership has been successful,” said Minxin Pei, a professor specializing in Chinese politics at Clare­mont McKenna College in California. “The messaging is that we should see the West’s response as bumbling and incompetent.”

Downward trends in China’s epidemic statistics suggest that its efforts have been effective. Only 19 new cases were reported Tuesday, all but two of them in Hubei province, of which Wuhan is the capital. Vast swaths of the province have been locked down since Jan. 23 as authorities tried to contain the novel coronavirus that causes the disease covid-19.

“It’s time to ‘pick the peaches’ and prove to the world that China has effectively controlled the outbreak,” said Zhang Lifan, an independent historian in Beijing.

But the draconian restrictions worked only after the flu-like virus had infected more than 80,000 people and killed about 3,140 in China, and had spread to dozens of other countries.

Italy, South Korea and Iran have been especially hard-hit, with Italy enforcing a nationwide lockdown. Global markets tumbled to their lowest levels in more than a decade, and economists are predicting a global recession.

International experts say the epidemic would have been more manageable, and could have been stopped from spreading abroad, if the authorities had responded in early January, when the virus’s severity became clear, rather than toward the month’s end.

In China, however, where the virus has posed the biggest political challenge to the ruling Communist Party in three decades, the state media have had a different story to tell. They have heralded Xi as the “people’s leader” commanding a “people’s war” against the virus, and have relentlessly tried to turn medical workers into heroes — and sometimes martyrs — on the front lines.

State media Tuesday reported that the last of the 14 “cabin hospitals” — quarantine centers built in stadiums to isolate the infected — had closed because they were no longer needed.

“In the past week, the propaganda has really been ramping up, highlighting the dwindling new infections and contrasting that with the rising infection rate overseas,” said Yun Jiang, a former Australian government official who now co-edits the China Neican blog. “They’re trying to tell a positive story about China’s and the Communist Party’s management of the situation.”

But through the course of the epidemic until Tuesday, Xi had not visited Hubei, instead sending the premier, Li Keqiang, in the early days and Vice Premier Sun Chunlan more recently. On a walk through Wuhan apartment complexes last week, residents went onto their balconies to shout “Fake, it’s all fake!” toward Sun, according to videos posted on Twitter.

“He is trying to repair the damage,” said Pei of Claremont Mc­Kenna College. “Before he sent Li Keqiang rather than go himself, and in retrospect that seems like a big mistake.”

Xi’s first stop Tuesday was Huo­shenshan Hospital, which was built in 10 days. State media said he visited patients, but television footage later showed a mask-clad Xi, surrounded by military and party officials, talking to a patient by video.

“You should build your confidence, we should together build our confidence, and together we will win this war,” Xi told the man, who was in bed, wearing striped pajamas, with two health-care workers in head-to-toe protective gear at his side. “Wuhan must win, Hubei must win, and the whole of China must win,” Xi said.

He appeared to be speaking from the Wuhan Workers’ Sanatorium, a facility next to the pop-up hospital.

He also talked to medical workers and army officers outside the building — standing a good 12 feet away from them — and to community workers and volunteers.

“This is a critical moment and you must clench your teeth and hang on,” Xi told them. “Don’t drop your guard, don’t relax. Pay attention to every detail of prevention and control, and resolutely win the battle,” state media quoted him as saying.

When he visited people stuck in their apartments in Wuhan, local authorities took steps to make sure there would be no repeat of the heckling that Sun received last week. Xi has also come in for heavy criticism, with China’s Internet lighting up with public criticism and calls for more freedom unseen in Xi’s seven years in power, although these posts were swiftly deleted by censors.

People posted photos on social media showing police officers sitting on the balconies, saying two officers had been dispatched to each apartment to ensure residents did not yell at Xi. The images could not be independently verified.

Instead, the main news bulletin on state broadcaster CCTV showed people calling “Hello, Chairman!” and waving from their windows at him as he walked through an apartment complex, and a smiling Xi saying “Hello, everyone” back.

The visit was clearly a “victory tour,” said Ryan Manuel, managing director of Official China, a consultancy specializing in China’s domestic political environment.

“He gave clear ‘important instructions’ in a way that showed he would own this coronavirus and the response,” Manuel said. “This was very unusual and personal. He put his name to the response, rather than making it collective.”

A Communist Party magazine last month stated that Xi knew about the virus as early as Jan. 7, more than two weeks before Wuhan was locked down. But since then, state media have portrayed Xi, the most powerful Chinese leader in decades, as very much in charge.

The visit also appeared to be designed to instill confidence in the domestic economy, which this quarter is predicted to fall well below the 6 percent annual growth rate that the party has long considered necessary to ensure stability and legitimacy.

Alarmed at the epidemic’s impact on China’s slowing economy, Xi has been prodding businesses across the country to reopen and trying to signal that things are going back to normal — even in Hubei.

Hubei is considering allowing people in medium- or low-risk areas to resume traveling, the official Hubei Daily reported Tuesday. They would have to use a code that requires users to submit health information on their phones and receive a “green” rating before they can enter stores or board public transportation.

Bill Bishop, publisher of the influential Sinocism newsletter, had listed a Xi visit to Wuhan as one of three “unmistakable signs the party thinks victory really is at hand.” The other two were the announcement of a new date for the postponed “two sessions” political meetings, and the reopening of schools shuttered since early February.

There have been no signs of dates being set for either of those milestones.

Liu Yang and Wang Yuan in Beijing contributed to this report.