Iran's Supreme Leader Ayatollah Ali Khamenei on Sunday said Saudi Arabia would face "divine revenge" for the wrongful execution of prominent Shia Muslim cleric Sheikh Nimr al-Nimr on Saturday.

"The unjustly spilt blood of this martyr will have quick consequences. This scholar neither encouraged people into armed action nor secretly conspired for plots but the only thing he did was utter public criticism rising from his religious zeal," AFP quoted Khamenei as saying.

Khamenei said execution of Nimr was "a political mistake by the Saudi government", adding: "God will not forgive. It will haunt the politicians of this regime".

Iranian Foreign Ministry spokesman Hossein Jaber Ansari also condemned Nimr's execution.

"The Saudi government supports terrorist movements and extremists, but confronts domestic critics with oppression and execution," AFP quoted Ansari as saying. Saudi will "pay a high price for following these policies," he said.

In what is considered to be the biggest mass execution in the Sunni-ruled kingdom, Saudi Arabia executed 47 people, including the Shi'ite cleric and al-Qaeda members, on Saturday. The execution was carried out in 12 cities, four prisons. While some of them were shot dead, others were beheaded, Reuters reported.

Most of the executed people were Sunnis, convicted for involvement in terror attacks in 2003 and 2004.

At least 35 people were killed in May 2003 attacks on expatriate compounds in Riyadh, while 22 died in 2004 attacks on a housing complex in the eastern city of Khobar. The deceased included Sunnis and foreigners, said the Saudi Interior Ministry, according to AFP.

Iranian protesters set Saudi embassy and consulate on fire

The execution of Nimr resulted in strong retaliation from Iran as several protesters stormed into the Saudi embassy in Tehran on Saturday night and hurled petrol bombs, setting it on fire and destroying the interiors.

The Iranian Police dispersed the protesters from the embassy and arrested a few of them.

The Saudi consulate in Iran's northeastern city of Mashhad was also attacked. Several angry protesters used handmade crackers to set the consulate on fire, IANS reported.

Sheikh Nimr al-Nimr was critic of the Saudi government and was very popular among the youth. He was arrested on 8 July, 2012, and sentenced to death 15 October, 2014, for "foreign meddling" and "disobeying" the Saudi rulers.