“Clean up the foreign trash!”. “Don’t turn our hometown into an international rubbish dump.” “This is China, not Nigeria!” Resembling the anti-migrant racist hatred you frequently see on UK social media, these are just a few examples of countless anti-African rants from Weibo users in China in a surge of popular racism over the past month.

Despite the huge amount of censorship on China’s social media, none of these posts have been removed. Migrants from sub-Saharan Africa have become the primary target of suspicion, racial discrimination and abuse amid public fear of a second wave of Covid-19. And this intolerance has peaked in Guangzhou, a city of 12 million people in the highly industrialised Guangdong province.

It started with the local government in Guangzhou implementing surveillance, conducting compulsory testing and enforcing a 14-day quarantine for all African nationals – even if they had earlier been tested negative and hadn’t recently travelled outside China. In Yuexiu district, the largest African migrant community in China, many Africans were evicted by landlords – despite having paid their rents – and left to sleep rough on the streets.

In an echo of apartheid South Africa or segregation-era United States, a colour bar was imposed across the city: Africans were refused entry by hospitals, hotels, supermarkets, shops and food outlets. At one hospital, even a pregnant woman was denied access. In a department store, an African woman was stopped at the entrance while her white friend was allowed in. In a McDonald’s restaurant, a notice was put up saying “black people cannot come in”.

The widespread racism has caused a huge public outcry across Africa, shared on social media under the hashtag #ChinaMustExplain. YouTuber Wode Maya, who has lived in China and is a fluent Mandarin speaker, urges fellow Africans to “wake up to what’s happening”. The global African diaspora has put pressure on African embassies and institutions to act. Last weekend the Kenyan government announced plans to allow its citizens stranded in China to be evacuated.

The official Chinese responses were at first silence or denial. State media such as Global Times and Xinhua failed to report the story in the first few days after the news broke in African news outlets. Later, the Chinese authorities began to recognise the reports of racism as “reasonable concerns”, though migrants continue to feel unsafe.

To outsiders, this horrendous racism may appear “unprecedented”. But ethnic minorities in China would find it all too familiar. In Shaoguan, not far from Guangzhou, the racist murder of two Uighur workers in 2009 triggered a series of events, such as the Ürümqi Incident, which led to further repression in the north-western region of Xinjiang.

The ideology of “race” in China goes back a long way. In the late 19th century, Qing imperial reformers searched for an “answer” that could revive China in face of European and Japanese colonialist expansion. “Race”, “nation” and nationalism have since been embedded into Chinese republicanism in the early 20th century, and then into the establishment of the Chinese Communist party.

Nationalism has taken deeper root in the four decades since Deng Xiaoping’s economic reforms. National revival has been a key ideological driver behind modernisation.

Today, assimilationism is at the centre of the concept of nation. Minzu, a key term used interchangeably for both ethnic group and nationality, refers to a group of common descent, with a distinct culture and territory.

In 2012, Xi Jinping began his rule by saying: “The China dream gathers Chinese aspirations and wishes for generations and manifests the interests of the whole Chinese nation (zhonghua minzu) …” The “China dream” became the political-economic programme for “the realisation of the great revival of the Chinese nation”.

This century is the “Chinese century”, Xi said. His multibillion-dollar Belt and Road Initiative was launched in 2013 as a massive global investment programme. From 2013 to 2018, the Chinese state invested nearly $614bnin developing countries. China’s foreign investment campaign is seen by some in Africa as colonialism, as the nations involved risk losing control of their essential infrastructure and natural resources, with their debt burden increased. China now holds 14% of the total debt stock in sub-Saharan Africa and has become the largest owner of public debt in Africa.

China’s growing presence brought with it labour migration from African countries from the late 1990s. People from Nigeria, Mali, Kenya, Senegal, Ghana and other west African countries came for work opportunities, mostly in the metropolis of Guangzhou. Many work in the city’s wholesale markets as other types of employment, including factory work, are closed to them. It’s commonly said by them that Africans are often “accepted as traders but discriminated against as people”. There are currently more than 15,000 African migrants with formal immigration status living in Guangzhou.

Although China has the lowest immigration in the world (migrants account for just 0.07% of the population), the authorities impose harsh “migrant management”. African migrants can often be criminalised in a similar way to the internal migrants from the countryside. Apart from immigration checks and crackdowns, the authorities consistently discourage migrants from living in certain neighbourhoods. There is no legal protection against racial discrimination.

The Covid-19 crisis has highlighted this longstanding anti-African racism. With all the damage this pandemic has done to the economy and people’s livelihoods, scapegoating and hostility towards an imagined outside threat clearly helps to divert domestic frustration away from the ruling elite – a trend we are all seeing worldwide. As Asian communities in Europe and the United States become victims of racism during this pandemic, Africans in China are crying out, “We are not the virus!” To resist racism, we need to see it for what it is, wherever it occurs.

• Hsiao-Hung Pai is a journalist and the author of Scattered Sand: The Story of China’s Rural Migrants