Saudi Arabia's severing of diplomatic ties with Iran may force the Islamic Republic to stop its citizens from going on the annual hajj pilgrimage, a prominent Iranian politician has said.

The sharp escalation between the Sunni and Shiite powerhouses came after the ransacking of the kingdom's embassy in Tehran and the attack on a consulate elsewhere in Iran - violence that erupted in the wake of Saudi Arabia's execution of a prominent Shiite cleric over the weekend.

Bahrain has also announced plans to sever its diplomatic ties with Iran. The rulers of the Gulf island kingdom, which is home to the US Navy's 5th Fleet, are closely allied with Saudi Arabia.

Saudi foreign minister Adel al-Jubeir announced the cut in Riyadh-Tehran relations late on Sunday and gave Iranian diplomatic personnel 48 hours to leave his country. All Saudi diplomatic personnel in Iran have been called home.

Mohammad Ali Esfanani, spokesman of the Judicial and Legal Committee of the Iranian parliament, said security issues and the fact that Iranian pilgrims would not have consular protection inside the kingdom made halting the pilgrimage likely, according to the semi-official ISNA news agency.

Both Saudi Arabia and Iran are yet to make any formal announcement about how the diplomatic spat would affect the hajj, a pilgrimage to Islamic holy sites in Saudi Arabia required of all able-bodied Muslims once in their life. The hajj this year is likely to begin in early September, though Muslims travel to the holy sites all year long as well.

"When a country has cut diplomatic relations with us, it means it is hostile with us," Mr Esfanani said. "It appears that protection (of pilgrims) and security issues will prevent hajj from taking place."

When Saudi Arabia severed ties with Iran from 1988 to 1991, Iran stopped its pilgrims from attending the hajj. Also, with Saudi diplomatic missions closed in Iran, it will make it difficult for Iranians to get visas for the hajj.

The Saudi decision to halt diplomatic relations came after its the mass execution of Shiite cleric Sheikh Nimr al-Nimr and 46 others - the largest carried out by Saudi Arabia in three and a half decades - laid bare the sectarian divisions gripping the region. Shiite protesters took to the streets from Bahrain to Pakistan while Arab allies of Sunni-ruled Saudi Arabia quickly lined up behind the kingdom.

Al-Nimr was a central figure in Arab Spring-inspired protests by Saudi Arabia's Shiite minority until his arrest in 2012. He was convicted of terrorism charges but denied advocating violence.

Al-Jubeir told a news conference in Riyadh that the Iranian government has "a long record of violations of foreign diplomatic missions", dating back to the occupation of the US Embassy in 1979, and such incidents constitute "a flagrant violation of all international agreements", according to the official Saudi Press Agency.

He said Iran's "hostile policy" was aimed "at destabilising the region's security", accusing Tehran of smuggling weapons and explosives and planting terrorist cells in the kingdom and other countries in the region. He vowed that Saudi Arabia will not allow Iran "to undermine our security".

Saudi Arabia's decision came after a protest on Sunday outside the Saudi Embassy in Tehran saw protesters throw stones and gas bombs, setting part of the building on fire, according to General Hossein Sajedinia, the country's top police official, the semi-official Tasnim news agency reported.

Forty people were arrested and police are pursuing other suspects, according to ISNA.

Another Saudi mission also was attacked in Mashhad, Iran.

Meanwhile, Bahrain also announced it would cut diplomatic ties with Iran, calling on all Bahrainis in Iran to leave the country within 48 hours as it planned to close its diplomatic missions there. It blamed the decision on the "cowardly" attack on Saudi Arabia's diplomatic mission, as well as allegations Iran smuggles weapons and explosives into Bahrain.

Bahrain frequently accuses Iran of being behind the long-running, low-level insurgency in the country since its majority Shiite population began protests in 2011 against Bahrain's Sunni rulers.

World powers sought to calm the tensions, with a Russian state news agency quoting an unnamed senior diplomat as saying Moscow is ready to act as a mediator in the escalating conflict. The RIA Novosti news agency did not say whether Moscow had made the mediation proposal to either side.

In Washington, State Department spokesman John Kirby said the Obama administration believes "diplomatic engagement and direct conversations remain essential in working through differences".

"We will continue to urge leaders across the region to take affirmative steps to calm tensions," Mr Kirby said.

The disruption in relations between Saudi Arabia and Iran may have implications for peace efforts in Syria. US Secretary of State John Kerry and others spent significant time trying to bring the countries to the negotiating table and they both sat together at talks aimed at finding a diplomatic solution to the civil war.

Last month, Saudi Arabia convened a meeting of Syrian opposition figures that was designed to create a delegation to attend peace talks with the Syrian government that are supposed to begin in mid-January.

Meanwhile, the state-run news agency of the United Arab Emirates (UAE) says the country is downgrading its diplomatic relations with Iran.

The UAE's Foreign Ministry also said it was recalling its ambassador from Tehran.

The statement said the UAE would be downgrading its diplomacy to only focus on business relationships between the Gulf federation and Iran.

UAE says it is doing this due to "Iran's continued interference in the Gulf and Arab countries internal affairs".