Iran's Supreme Leader Ayatollah Ali Khamenei threatened regional rival Saudi Arabia with "divine vengeance" after the execution of a top Shiite cleric known for his activism against the kingdom's Sunni government.
Khamenei's warning on Sunday came hours after angry Iranians stormed the Saudi embassy in Tehran protesting the execution of cleric Nimr al-Nimr.
The prominent Saudi Shiite cleric was among 47 people that the Saudi government said it had executed on Saturday after their convictions on terrorism-related charges.
The executions have sparked outrage in the region and raised fears of further stoking sectarian tensions.
"The unjustly spilled blood of this martyr will have consequences," Khamenei said, according to the ISNA state news agency. "The Saudi leaders will feel divine vengeance."
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.
Iranian police arrested 40 demonstrators after the embassy attack in which parts of the building were set on fire.
Iranian President Hassan Rowhani condemned the violence. "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, secret service and police should go after the culprits forcefully, Rowhani said in a statement.
In Cairo, Arab League chief Nabil al-Araby condemned the embassy attack as a "flagrant breach of international charters."
He called on Iran to refrain from "interfering" in the affairs of Arab countries.
Saudi Arabia and its Sunni allies have frequently accused Iran of inciting Shiites in their countries to cause unrest, an accusation denied by Tehran.
Saudi authorities lashed back at Tehran's condemnations over al-Nimr's execution and accused 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."
The European Union's foreign policy chief, Federica Mogherini, called for avoiding an escalation of sectarian tensions in the region.
"The security and stability of the whole region, that is already facing great threats, is at stake," Mogherini said in a statement.
Relations between Riyadh and Tehran have soured in recent months with both backing opposing sides in the conflicts in Syria and Yemen.
Al-Nimr, 55, had been condemned to death in 2014 on charges of causing sectarian strife and disobeying the country's ruler.
Saudi authorities, meanwhile, refused to hand over the bodies of those executed, including that of al-Nimr, to their families, his brother Mohammed al-Nimr said in a tweet.
"Call from authorities told us that martyrs' bodies were buried in Muslim cemeteries away from their relatives."
There was no official comment.
Al-Nimr's 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.
Iraq's top Shiite cleric Ali al-Sistani 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 those executed included four Shiites.
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.