In the last few weeks, China has donated coronavirus testing kits to Cambodia, sent planeloads of ventilators, masks and medics to Italy and France, pledged to help the Philippines, Spain and other countries, and deployed medics to Iran and Iraq.

The Chinese president, Xi Jinping, has offered comforting words, telling the Spanish prime minister, Pedro Sánchez, that “sunshine comes after the storm”, and adding that the two countries should step up cooperation and exchanges after the outbreak.

As the coronavirus outbreak spreads and countries struggle to respond, China has positioned itself as a leader and benefactor in public health, building the kind of soft power Beijing needs at a time of intensifying US-China rivalry and scrutiny of Chinese influence around the world.

The coronavirus first emerged in the central Chinese city of Wuhan in December and threw the country into a state of emergency as more than 80,000 people were infected and more than 3,000 died. Public anger and criticism over the government’s initial suppression of information and slow response, enabling the virus to spread, posed one of the most serious threats to the Chinese leadership in decades.

How did China get to grips with its coronavirus outbreak? Read more

But as the number of new infections has dropped dramatically after stringent quarantine measures and social distancing by the public, China’s messaging has shifted. In recent weeks, Beijing has claimed almost-victory over the virus and state media have hailed China’s support for other countries facing the outbreak.

“Now we see Chinese officials and state media claiming that China bought the world time to prepare for this pandemic,” said Natasha Kassam, a research fellow at the Lowy Institute in Sydney and a former Australian diplomat.

“We know the propaganda machine within China is able to rewrite history but now we are seeing that replicated overseas,” said Kassam. “China’s victory over Covid-19 has already been written and authorities are trying very hard for that message to be received overseas.”

Facebook Twitter Pinterest Medical staff from Yunnan Province wave goodbye on the plane at Wuhan Tianhe International Airport. Photograph: Chine Nouvelle/SIPA/REX/Shutterstock

Experts say that, while these humanitarian efforts are real, they have political ends that deserve attention. In a phone call with the Italian prime minister, Giuseppe Conte, this week, Xi said he hoped to establish a “health silk road” as part of China’s global One belt, One Road initiative, which has come under criticism from countries wary of expanding Chinese leverage and influence.

“There is nothing wrong with China helping European and other countries, especially now that it has gained the upper hand in containing the coronavirus at home. But it is also clear that [Beijing] sees its aid as a propaganda tool,” said Noah Barkin, senior visiting fellow at the German Marshall Fund.

According to Barkin, by offering support to countries like Italy, Beijing highlights the struggles European countries have had in helping each other and draws a favourable contrast between itself and the US. “While Trump is hitting Europe with a travel ban, China is the generous, selfless friend,” Barkin said.

The effort appears to be working. Last week, Italy’s foreign minister Luigi Di Maio posted a video of himself on Facebook watching live footage of a plane of supplies and medics from China, noting that China was the first to send aid. Serbian president Aleksandar Vučić said in a press conference this week that he believes in his “brother and friend Xi Jinping”. He said: “The only country that can help us is China.”

The campaign is aimed at domestic audiences as much as it is directed at the international community. Recent state media headlines describe Chinese medics arriving in Italy in response to the country’s “cries for help”.

Coronavirus: Wuhan doctor speaks out against authorities Read more

“It sends a message to the domestic audience that China has overcome the crisis at home and is now able to help others. This helps fuel the Chinese communist party’s feel-good narrative, shifting attention away from its early failures to tackle the crisis,” said Barkin.

But witnesses and critics of China’s early response are unlikely to forget the recent history. And in some cases, the messaging has gone too far. A recent graphic published by the People’s Daily showing the number of new infections around the world had surpassed those within China included a gleeful headline hailing the “reverse” in fortunes.

One user commented: “The water pipes in your home broke and you flooded other people’s homes. Is this the golden age you wished for?”