When China's health authorities started recording a growing number of imported cases of coronavirus last month, foreigners in the country suddenly found themselves the unwitting target of discrimination.
Some were turned away at shops and restaurants, and others had difficulty going back to their rented homes and offices, even after completing a mandatory 14-day quarantine following their return to China.
Yet others had abuse hurled at them or were given a wide berth, as the country seizes up in fear watching runaway infections and collapsed healthcare systems in other parts of the world.
It did not seem to matter that the National Health Commission had said that 90 per cent of imported cases were returning Chinese nationals.
Videos of foreigners who flout local rules, such as refusing to wear face masks or defying quarantine, started making the rounds furiously on social media, stoking anger and fanning growing antiforeigner sentiment.
Then came a viral racist comic published on WeChat on April 2 that depicted two Chinese, one in a full protective suit, sorting "foreign trash" by dragging offending foreigners and throwing them into bins for recyclables, wet and dry waste.
Their crime? One refused to wear a face mask. One cut the queue for coronavirus testing, then abused Chinese people in the line. One illegally entered China to escape the outbreak at home.
The comic's author took it down within days, but by then, Africans in Guangzhou were bearing the brunt of this tide of xenophobia because of a cluster of cases in the southern city, which has the largest population of Africans in China.
Instances of Africans evicted from their homes and forced to sleep rough prompted the African Union and various embassies to lodge diplomatic protests, raising tensions and threatening to dent Beijing's systematic efforts in cultivating the continent.
China does not tolerate discrimination and applies the same anti-coronavirus standards to citizens and foreigners, said Foreign Ministry spokesman Zhao Lijian.
But the Communist Party paper, People's Daily, was more blunt in an editorial where it said that "when some foreigners consider themselves as being superior to their Chinese counterparts and thus entitled to preferential treatment, it is natural that Chinese people consider such foreigners to be unwelcome".
There are nearly a million foreigners who work in China. Figures released by the Guangzhou immigration authorities in 2018 showed more than 340,000 people from African countries with temporary accommodation registration records in the city of 15 million, while long-term residents accounted for 5,396.
The Guangzhou authorities said on April 14 that every African national in the city had been tested and at least 111 of the more than 4,500 Africans tested had the coronavirus.
In an open letter to President Xi Jinping last Wednesday, Dr Arikana Chihombori-Quao, president of the Africa Diaspora Development Institute, an umbrella organisation representing more than 210 million people, described the "inhumane" treatment of Africans in Guangzhou as "deplorable, unlawful and criminal".
"They contravene international human rights norms and conventions, and have the potential of precipitating reprisals against Chinese nationals on the African continent," she said.
The pandemic is not solely to blame for this recent wave of racism. In 2016, a television commercial for a detergent caused an uproar worldwide after it depicted a black man forced into a washing machine and emerging as a Chinese man.
"These incidents will put a damper on China's attempt to take leadership in the developing world," China researcher Yun Jiang said of the recent episodes in Guangzhou.
"If not managed properly, it could jeopardise China's relationship with some African countries," said the director of China Policy Centre, an independent research organisation in Canberra, Australia.