Gregg Zoroya, and John Bacon

USA TODAY

The Iranian government called for calm Sunday after protesters angered at the execution of a prominent Shiite cleric in Saudi Arabia broke into the Saudi embassy in Tehran, setting fires and flinging documents from the roof.

Iran’s Supreme Leader Ayatollah Ali Khamenei also warned that "divine vengeance will befall Saudi politicians" for the execution of Sheikh Nimr al-Nimr.

Iranian police worked to disperse the crowd that had gathered late Saturday to express outrage at the execution of al-Nimr, an outspoken critic of the Saudi government who denied advocating violence. .

Tehran Prosecutor Abbas Jafari-Dowlatabadi said the protest had been broken up Sunday, the semi-official ISNA news agency said.

“So far, some 40 individuals who were involved in entering the building were identified and arrested," the prosecutor told ISNA. "Research is underway to identify other people who played a role in the incident.”

Iranian leaders asked that protesters not gather at "diplomatic sites," ISNA reported.

Al-Nimr was one of 47 people executed Saturday in Sunni-dominated Saudi Arabia. Ali bin Suleiman Al-Obaid, the Saudi vice general president for Prophet's Holy Mosque Affairs, confirmed the "implementation of Shariah rulings," saying those executed "disturbed the security of the nation, shed the infallible blood, sought amok, terrorized innocent people, destroyed properties, and incited others like them on murder and sabotage," the Saudi Press Agency confirmed.

The listed also included a man convicted of the 2004 shooting that killed a BBC cameramen and wounded a correspondent, the BBC World Service reported.

The June 2004 shooting in the Saudi capital, Riyadh, killed 36-year-old Irish cameraman Simon Cumbers. British reporter Frank Gardner, now the BBC's security correspondent, was seriously wounded and paralyzed, but survived.

Iranian protesters overrun Saudi embassy, set fires

Protesters scaled a chain-link fence protecting the embassy, took down the Saudi flag and set fires inside, according to tweets from journalist Sobhan Hassanvand at the privately owned Shargh newspaper. But the angry mob didn't destroy the flag because it is emblazoned with the Muslim statement of faith that Shiites and Sunnis share: "There is no God but Allah and Muhammad is his prophet."

A “huge crowd of people rushed toward the entrance gate of the building passing through resisting police forces and managed to break the gate,” according to Sadra Saeidian of Mehr News.

No one appeared to be injured, according to several Iranian media reports. Also in Iran, demonstrators attacked a Saudi consulate in the city of Mashhad with parts of the building set on fire, China’s official Xinhua news agency reported, citing Persian-media outlet Tabnak.

The Iranian Foreign Ministry summoned the deputy head of the Saudi mission in Tehran to protest the execution. Iranian Deputy Foreign Minister for Arab and African Affairs Hossein Amir-Abdollahian accused Saudi Arabia of triggering a new conflict in the region despite failing to "fulfill its responsibility" in the wake of last September’s Mina disaster which more than 2,000 pilgrims who were in Saudia Arabia for the Hajj, ISNA reported.

A war of words continued Sunday between top Saudi and Iranian leaders.

Iran's powerful Revolutionary Guard compared Saudi Arabia's execution of an opposition Shiite cleric to attacks carried out by the extremist Islamic State group.

The Guard said in a statement Sunday that Saudi Arabia's "medieval act of savagery" in putting al-Nimr to death will lead to the "downfall" of the monarchy.

The comments by the Guard mirror those of Iran's Supreme Leader Ayatollah Ali Khamenei, who also strongly criticized the sheikh's execution. Khamenei said Saudi Arabia will face "divine revenge" after the execution of a revered Shiite cleric.

Khamenei's website carried the comments by the ayatollah, who also criticized the ongoing Saudi-led war in Yemen against Shiite rebels, as well as the "persecution" of Shiites living in Saudi-allied Bahrain.

Also on Sunday, Khamenei's English-language Twitter account said: "Doubtlessly, unfairly spilled blood of oppressed martyr #SheikhNimr will affect rapidly & Divine revenge will seize Saudi politicians."

Saudi Arabia said that by condemning the execution of an opposition Shiite cleric, Iran has "revealed its true face represented in support for terrorism."

A Foreign Ministry statement carried by the official Saudi Press Agency accuses Tehran of "blind sectarianism" and says that "by its defense of terrorist acts" Iran is a "partner in their crimes in the entire region."

Al-Nimr was a central figure in protests by Saudi Arabia's Shiite minority until his arrest in 2012. He was critical of the Saudi government and but denied ever advocating violence.

The mass executions — by beheading or shooting — "only further stains Saudi Arabia's troubling human rights record," said Sarah Leah, Middle East director for the U.S.-based non-profit Human Rights Watch.

United Nations Secretary-General Ban Ki-moon was “deeply dismayed” over the Saudi Arabia executions, including that of Al-Nimr, 56, according to a UN statement.

U.S. says Iran tested rockets 1,500 yards from American carrier

The U.S. State Department also issued a statement about the executions and al-Nimr.

"We are particularly concerned that the execution of prominent Shia cleric and political activist Nimr al-Nimr risks exacerbating sectarian tensions at a time when they urgently need to be reduced," the statement said. It added that the U.S. has issues with the legal process in Saudi Arabia and that the government there needs to respect human rights and conduct transparent judicial proceedings.

Amnesty International, another human rights organization, decried the death sentences for al-Nimr and other Shiite activists in November, saying, "Saudi Arabian authorities are using the guise of counterterrorism to settle political scores."

Protests sprang up Saturday in multiple countries after the cleric's execution. Hundreds of his supporters took the streets in his hometown of al-Qatif in eastern Saudi Arabia and in neighboring Bahrain, where police responded with tear gas and bird shot, according to AP.

The sheikh’s brother, Mohammed al-Nimr, said in a telephone interview with AP that Saudi authorities told the family they had already buried the body but didn’t say at which cemetery. The family had hoped to bury his body in his hometown.

Nimr al-Nimr's funeral likely would have attracted thousands of supporters, including large numbers of protesters. Instead the family planned to hold prayers and accept condolences at the mosque in a village near al-Qatif where the sheikh used to pray.

Of the 47 executed, 45 were Saudi nationals, one was from Chad and another from Egypt. Four were Shiites.

Also among those executed was a convicted terrorist involved in a 2004 attack on the U.S. Consulate in Jeddah that left nine dead. Another was Faris al-Shuwail, a leading ideologue in al-Qaeda’s Saudi branch who was arrested in August 2004 during a massive crackdown following the series of deadly attacks, AP reported.

Contributing: The Associated Press