Hong Kong(CNN) China is closing its border to most foreigners amid fears of imported novel coronavirus cases causing a second outbreak in the country where the infection was first detected.

In a statement late Thursday, the government said that "in view of the rapid spread of Covid-19 across the world, China has decided to temporarily suspend the entry into China by foreign nationals holding visas or residence permits" as of March 28.

Anyone wishing to enter the country will have to apply for a new visa at their local Chinese embassy or consulate. The announcement did not say how long this would take.

The decision to effectively seal off the country to foreigners is the latest in a series of moves intended to safeguard against infection from international travel, after more than 500 imported cases of the coronavirus were confirmed.

On Monday, Beijing city authorities announced that all international arrivals would be quarantined and tested for the virus at designated government facilities. Other cities have implemented stringent home quarantine requirements on international arrivals. Last week, a Chinese Australian woman was deported after neighbors recorded her breaching isolation controls to go jogging.

The number of new domestic infections has slowed to a trickle in recent weeks. While Wuhan, the city previously at the epicenter of the outbreak, remains on lockdown, much of the rest of the country is returning to normal.

There are fears imported cases could lead to a renewed outbreak.

Hong Kong, a semi-autonomous Chinese city, already had to backtrack on relaxing restrictions after a spike in new infections, many of which were imported by international travelers.

Staff wear protective masks and visors as they walk in the arrivals area at Beijing Capital International Airport on March 24.

No 'foreign friends'

Across China, reports have appeared in recent days of businesses banning foreign nationals from entering their premises. Accounts have even emerged of housing estates and office complexes barring non-Chinese from the premises.

All of that is despite the fact 90% of imported cases are linked to Chinese citizens returning from overseas, particularly the hundreds of thousands of students forced home by university closures.

While the backlash against foreigners in China has not reached anything near the level of violence and open racism experienced by many Asians living in parts of Europe and the US, it appears to be part of a broader rise in xenophobia, seen in a number of Asian countries battling the outbreak.

Elizabeth Rodewald, an American working in Beijing, said she was stopped by her security guard from entering her own home this week. She said the guard asked if she was Russian and refused to let her pass even after she showed her residential ID card, even though Chinese residents continued to enter freely. She said she had to wait for the manager to arrive before she could go in.

At a Beijing gym popular with expats, managers posted a sign saying "foreign friends" would no longer be allowed to enter, "because of (the) overseas epidemic threshold." CNN also saw doormen at a bar in Sanlitun, a popular Beijing nightlife area, refusing entry to non-Chinese-looking patrons.

These restrictions are not government backed and enforcement of them appears to not be rigorous.

At the bar in Sanlitun, for example, security staff did not check IDs, so ethnically Chinese foreign residents could enter. Jim Boyce, a Beijing resident who posted on Twitter about restrictions on foreigners, said that one barber shop which put up a sign barring non-Chinese still allowed at least one expat to get his hair cut there.

Some 900,000 foreigners live in China, according to state media, with the largest non-Chinese population in Shanghai. While the government has gradually made it easier for foreigners to apply for permanent residency, as it attempts to attract more overseas talent and investment, the number of foreigners who gain this status is still exceptionally small.

In 2010, when the last census was carried out, there were just 1,448 naturalized citizens in China, a nation of over 1.3 billion people.