DUBAI (Reuters) - President Hassan Rouhani asked Iran’s judiciary on Wednesday to urgently prosecute the people who attacked the Saudi embassy in Tehran in protest at the kingdom’s execution of a prominent Shi’ite cleric.

An Iranian riot police stands guard as protesters hold street signs with the name of Shi'ite cleric Sheikh Nimr al-Nimr during a demonstration against the execution of Nimr in Saudi Arabia, outside the Saudi Arabian Embassy in Tehran January, 3, 2016. REUTERS/Raheb Homavandi/TIMA

Rouhani’s comments appear to show his determination to reduce tension with Iran’s Sunni Gulf neighbors and continue his attempts to normalize ties with world powers by speaking out on a practice that has become a challenge for the Islamic Republic’s foreign policy.

Saudi Arabia, Bahrain, Sudan and Djibouti broke all ties with Iran this week, the United Arab Emirates downgraded its relations and Kuwait recalled its ambassador after the embassy was stormed. Jordan summoned Iran’s ambassador.

After reaching a landmark nuclear deal with world powers in July, Rouhani is seeking to end Iran’s long isolation with the West. However, the repercussions of the attack could jeopardize that, posing the biggest diplomatic crisis of his government.

Members of the U.N. Security Council released a statement on Monday condemning the attack, and another on a consulate in the city of Mashhad, “in the strongest terms”.

“By punishing the attackers and those who orchestrated this obvious offense, we should put an end once and forever to such damage and insults to Iran’s dignity and national security,” Rouhani was quoted as saying in a letter published on the state news agency IRNA.

While embassies are often a focus of protests worldwide, Iran still celebrates the anniversary of the 1979 takeover of the U.S. embassy in Tehran every year and refers to it as the Second Revolution.

Since then, Iranians have attacked several embassies in Tehran, including those of Kuwait in 1987, Saudi Arabia in 1988, Denmark in 2006 and Britain in 2011, most of which have led to a breach in diplomatic relations.

PROTEST SELFIES

Some of those attacking the Saudi embassy and starting fires took selfies and published them on social media, a clear sign that they thought they were enjoying immunity from jurisdiction in a country that has parallel centers of power.

In the letter to the head of judiciary, Rouhani asked Sadeq Larijani, to bring those behind the attacks to justice.

“This has been always a paradox in the Islamic Republic,” said Hossein Rassam, a former political adviser at the British embassy in Tehran.

“While the revolutionary state condones or supports such attacks to capitalize on their revolutionary momentum, the administration dismisses them as it should deal with their diplomatic consequences,” he added.

In a signal of how Western ties with Iran have thawed, Britain reopened its embassy in Tehran in August. The nuclear deal also prompted a flurry of European visits aimed at positioning for the end of Iran’s economic isolation.

Iranian police have already announced the arrest of 50 people for the attacks on the Saudi mission. However, in previous cases the rioters have been detained for a few days and released without facing any charges.

“In the case of the British embassy we are not aware of any legal action taking place against the aggressors,” said Rassam.

“Although months later (the Supreme Leader) Ayatollah Khamenei criticized the move, the attackers walked free and nothing happened to them more than a gentle slap on the hand.”

The Iranian government has distanced itself from the attack, saying the protesters entered the Saudi embassy despite widespread efforts by the police to stop them.