Tensions grew Sunday between Saudi Arabia and its regional rival Iran, a day after Riyadh executed a prominent Shiite cleric, angering the region's Shiites.
Iran's Supreme Leader Ayatollah Ali Khamenei threatened Saudi Arabia with "divine vengeance" after the execution of the Saudi Shiite cleric known for his activism against the kingdom's Sunni government.
Al-Nimr was among 47 people the Saudi government said it had executed on Saturday after their convictions on terrorism-related charges.
The executions sparked outrage in the region, spurring demonstrators to storm the Saudi embassy in Tehran and set parts of the building on fire.
"The unjustly spilled blood of this martyr will have consequences," Khamenei said, according to an ISNA state news agency report. "The Saudi leaders will feel divine vengeance."
Police arrested 40 demonstrators after the embassy attack. Security forces brought the situation under control.
Iranian President Hassan Rowhani condemned the violence, saying in a press statement issued Sunday, "The attack by extremists on the Saudi embassy in Tehran can in no way be justified and it had negative consequences for Iran's image." The Interior Ministry, the secret service and the police should go after the culprits forcefully, he said.
"Such ugly actions should be put paid to once and for all," he said.
Meanwhile, Saudi authorities lashed back at Tehran's condemnations, accusing Iran of supporting "terrorism."
"By defending terrorists' acts, the Iranian regime is considered a partner in their crimes," the Saudi Foreign Ministry said in a statement carried by the official Saudi Press Agency.
The statement also accused Shiite Iran of following "blind sectarianism."
Relations between Riyadh and Tehran have soured in recent months with both backing opposing sides in conflicts in Syria and Yemen.
Al-Nimr repeatedly demanded increased rights for the Shiite minority in Saudi Arabia, who make up some 15 per cent of the population. The cleric never called for an armed uprising and had only fulfilled his religious duties, Khamenei said.
Al-Nimr, 55, had been condemned to death in 2014 on charges of causing sectarian strife and disobeying the country's ruler.
A top Saudi court upheld the ruling in October.
His execution has sparked protests in Shiite-majority Bahrain, which is Sunni-ruled.
In Iraq, hundreds of Shiites took to the streets on Sunday to protest al-Nimr's execution.
The protesters, led by Shiite clerics and politicians, gathered in several areas in the mostly Shiite province of Wasit in central Iraq.
They called on the Iraqi government to close the Saudi embassy, which was reopened last month after 25 years.
"We have shown up today to condemn the Saudi authorities' execution of Sheikh Nimr al-Nimr, who is one of the top religious figures in the world," Mohammed Abdel-Hadi, who organized a rally, said.
Iraq's top Shiite cleric Ali al-Sistani meanwhile denounced al-Nimr's execution as "unjust" and described him as a "martyr."
"We have received with extreme sadness and sorrow the news of the martyrdom of our faithful brothers, including the late Sheikh Nimr al-Nimr," he said in a statement, according to independent Iraqi news website Alsumaria.
Saudi sources said Saturday's executed included four Shiites.
Al-Sistani's comment is the latest in a series of condemnations of the executions.
UN Secretary-General Ban Ki-moon said he was "deeply dismayed" over the executions.
"Sheikh al-Nimr and a number of the other prisoners executed had been convicted following trials that raised serious concerns over the nature of the charges and the fairness of the process," Ban's spokesman said in a statement.
Saudi Arabia's Shiites complain of discrimination, saying they often struggle to get senior government jobs and benefits available to other citizens. The government has repeatedly denied the claims.