A new draft law that could make it easier for foreigners to gain permanent residency in China has stirred up a torrent of xenophobia online.

The proposal, released by the justice ministry last week, has been gathering billions of views and a flood of angry posts on social media, targeting Africans in particular.

“China’s forty years of family planning policy does not make it a place for foreign trash to soar,” wrote one user on the Twitter-like platform Weibo, referring to the one-child birth limit China imposed between 1980 and 2016.

The person went on to use racist language against black people, saying: “Our common Chinese ancestry will not be tainted by Africans.”

Some Weibo-users posted videos of black people apparently committing crimes in China, while a campaign to encourage Chinese women to date Chinese men, under the hashtag “China girl”, had 240 million views as of Thursday afternoon.

Another widely-shared post on Weibo read: “China is not an immigrant country.”

A hashtag related to the law has gained more than 4.8 billion views.