Saudi Arabia has barred foreigners from entering the country – including those coming to visit the holiest sites in Islam – following fears about the spread of coronavirus.

The country’s decision comes months before the annual hajj pilgrimage and after 220 confirmed cases of the Covid-19 illness have been recorded in the Middle East.

The decision stops foreigners from reaching the holy city of Mecca and the Kaaba, the cube-shaped structure the world’s 1.8 billion Muslims pray toward five times a day.

READ MORE: Donald Trump says US 'very, very ready' for outbreak of disease

Fears over the outbreak potentially spreading into Saudi Arabia appear to have prompted the decision, with the country’s oil-rich monarchy staking its legitimacy on protecting Islam’s holy sites.

The centre of the outbreak in Iran, the most-affected country in the Middle East, appears to be in the holy Shiite city of Qom, where a shrine there sees the faithful reach out to kiss and touch it in reverence.

“Saudi Arabia renews its support for all international measures to limit the spread of this virus, and urges its citizens to exercise caution before travelling to countries experiencing coronavirus outbreaks,” the Saudi Foreign Ministry said in a statement announcing the decision.

“We ask God Almighty to spare all humanity from all harm.”

Since it emerged in December in central China, the new coronavirus has sickened 82,000 people globally, with more than 2,700 deaths.

While millions attend the hajj, which is this year set for late July into early August, millions more come during the rest of the year to the holy sites in the kingdom.

Those other pilgrimages are referred to as the umrah.

READ MORE: Coronavirus now spreading faster in rest of world than in China

One of the biggest times for the umrah is the Muslim holy fasting month of Ramadan, which is set to begin at the end of April.

“It is unprecedented, at least in recent times, but given the worldwide spread of the virus and the global nature of the umrah, it makes sense from a public health and safety point of view,” said Kristian Ulrichsen, a research fellow at the James A Baker III Institute for Public Policy at Rice University.

“Especially since the Iranian example illustrates how a religious crossroads can so quickly amplify the spread and reach of the virus.”