Iranian protesters have broken into the Saudi Arabian embassy in Tehran after Riyadh announced the execution of Shia religious leader Nimr al-Nimr, one of 47 men killed on terrorism charges.

The Saudi interior ministry announced the executions on Saturday, listing the names of the 47 killed, all of whom had been convicted on charges of terrorism.

The government said those convicted had plotted or participated in attacks against residential compounds and government buildings.

Nimr, who led anti-government protests in the country's east, was previously convicted of sedition, disobedience and bearing arms. Nimr did not deny the political charges against him, but said he never carried weapons or called for violence.

Many of the other men executed had been linked to attacks in the kingdom between 2003 and 2006, blamed on al-Qaeda.

Faris al-Zahrani, described by Saudi media as al-Qaeda's top religious leader in the kingdom, was one of those executed.

An Egyptian citizen and a Chadian citizen were also among the executed, the ministry said. The rest were all Saudis.

Despite calls for calm from Nimr's brother following the announcement of the executions, a number of protesters gathered at the Saudi embassy in Iran's capital Tehran, to protest the religious leader's death.

Several of the protesters gained access to the embassy building and started fires, before eventually being removed from the compound by police late on Saturday night. Forty people were arrested over the embassy attack, authorities said.

Iran's foreign ministry called for calm following the incident, after earlier condemning Nimr's execution, calling it "the depth of imprudence and irresponsibility" on the part of the Saudi government.

"The Saudi government will pay a heavy price for adopting such policies," Hossein Jaber Ansari, Iran's foreign ministry spokesman, was quoted as saying by the semi-official Fars news agency.

Iran's Supreme Leader Ayatollah Ali Khamenei warned on Sunday that "divine vengeance will befall Saudi politicians" over Nimr's execution.

The Saudi government summoned the Iranian ambassador to protest against Iran's reaction to the execution, saying Iran had "revealed its true face represented in support for terrorism".

Elsewhere, dozens of people marched through Bahrain's capital to protest the executions, while in London, people gathered outside the Saudi embassy, voicing their support for Nimr. Other protests were held in Pakistan and Yemen.

There were also protests within Saudi Arabia, with people taking to the streets in the eastern town of Al-Awamiya.

The US state department said Nimr's execution risked "exacerbating sectarian tensions at a time when they urgently need to be reduced", while UN Secretary-General Ban Ki-moon said he was "deeply dismayed" by the executions.

Saudi Arabian authorities, however, defended the executions.

Ministry of Justice spokesman Mansour al-Qufari said: "The judiciary is objective and we deal objectively with the cases on merit.

"There is no difference between what a person does regardless of his ethnic origin or affiliation, or what he believes. We deal with facts and criminal intent."

Hussain al-Shobokshi, a prominent Saudi columnist, told Al Jazeera that Saudi authorities did not differentiate between "Shia source of terror and Sunni source of terror".

"[Saudi Arabia] made sure it saw no difference between any form of terror, as long as it was threatening its people and its economy," he said.

Nimr spent more than a decade studying theology in predominantly Shia Iran.

He had called for Eastern Province, an oil-rich region where about two million Shia live, to be separated from the rest of Saudi Arabia.

He also criticised the government for what he said was the marginalisation of the Shia minority in the country.