Saudi Arabia has said it has severed ties with Iran over the storming of the Saudi embassy in Tehran, in a worsening diplomatic crisis between the regional rivals following the kingdom's execution of a prominent Shia cleric.

Foreign Minister Adel al-Jubeir told a news conference Iran's diplomatic mission and related entities in Saudi Arabia had been given 48 hours to leave.

He said Riyadh would not allow the Islamic Republic to undermine the Sunni kingdom's security.

Iranian protesters stormed the Saudi embassy in Tehran early on Sunday and Shia Muslim Iran's top leader, Ayatollah Ali Khamenei, predicted "divine vengeance" for the execution of Sheikh Nimr al-Nimr, an outspoken opponent of the kingdom's ruling Al Saudi family.

Mr Jubeir said the attack in Tehran was in line with what he said were earlier Iranian assaults on foreign embassies there and with Iranian policies of destabilising the region by creating "terrorist cells" in Saudi Arabia.

"The kingdom, in light of these realities, announces the cutting of diplomatic relations with Iran and requests the departure of delegates of diplomatic missions of the embassy and consulate and offices related to it within 48 hours.

The ambassador has been summoned to notify them," he said.

40 people were arrested after the embassy was attacked and set on fire.

Iranian protesters gather outside the Saudi Embassy in Tehran

Bahraini protesters use palm trunks to block roads during clashes with riot police following a protest in the village of Jidhafs, west of Manama

Demonstrators protest outside the Saudi Embassy in London, following Saudi Arabia's execution of 47 prisoners in one day