Iran’s supreme leader warned Saudi Arabia of “divine revenge” Sunday following the execution of a prominent Shiite cleric while Riyadh accused Tehran of supporting terrorism, escalating a war of words after protesters stormed the Saudi Embassy in Tehran.

Sheikh Nimir al-Nimir was executed Saturday along with 46 others, including three other Shiite dissidents and a number of Al Qaeda militants. Al-Namir was a key leader in the Arab Spring protests in Saudi Arabia before his arrest in 2012. His execution drew condemnation from Shiites across the region as well as several countries outside Iran.

Iran's Supreme Leader Ayatollah Ali Khamenei condemned the execution Sunday in a statement on his website, saying al-Nimr "neither invited people to take up arms nor hatched covert plots. The only thing he did was public criticism."

Iran’s Revolutionary Guard also lashed out at Saudi Arabia Sunday. They compared the executions to attacks carried out by the Islamic State. The Guard said in a statement that Saudi Arabia’s “medieval act of savagery” in putting al-Nimir death will lead to the “downfall” of the monarchy.

The Guard promised “harsh revenge” against the Saudi royals for the execution, according to Reuters.

Al-Nimr was convicted of terrorism charges but denied ever advocating violence.

Meanwhile, crowds gathered outside the Saudi Embassy early Sunday and chanted anti-Saudi slogans. Protesters threw stones and Molotov cocktails at the embassy, igniting a fire in one part of the building, said the country’s top police official, Gen. Hossein Sajedina.

At least 40 people were arrested on suspicion of taking part in the violent protests, according to Tehran prosecutor Abbas Jafari Dowlatabadi. The semi-official ISNA news agency said investigators were searching for several other suspects.

Sunni Saudi Arabia and Shiite Iran are locked in a bitter rivalry, and support opposite sides in the wars in Syria and Yemen. Iran accuses Saudi Arabia of supporting "terrorism" in part because it backs Syrian rebel groups, while Riyadh points to Iran's support for the Lebanese Hezbollah and other Shiite militant groups in the region.

The Iranian Foreign Ministry has summoned the Saudi envoy in Tehran to protest, while the Saudi Foreign Ministry later said it had summoned Iran's envoy to the kingdom to protest the critical Iranian reaction to the sheikh's execution, saying it represented "blatant interference" in its internal affairs.

The cleric's execution could also complicate Saudi Arabia's relationship with the Shiite-led government in Iraq. The Saudi Embassy in Baghdad reopened for the first time in nearly 25 years on Friday. Already on Saturday there were public calls for Prime Minister Haider al-Abadi to shut the embassy down again.

Al-Abadi tweeted Saturday night that he was "shocked and saddened" by al-Nimr's execution, adding that "peaceful opposition is a fundamental right. Repression does not last."

Hundreds of al-Nimr's supporters also protested in his hometown of al-Qatif in eastern Saudi Arabia, in neighboring Bahrain where police fired tear gas and bird shot, and as far away as northern India.

The Associated Press contributed to this report.