BAGHDAD — Saudi Arabia cut diplomatic ties with Iran on Sunday and gave all Iranian diplomats 48 hours to leave the kingdom, as escalating tensions over the execution of an outspoken Shiite cleric inSaudi Arabia marked a new low in relations between the two Middle Eastern powers.
The surprise move, announced in a televised news conference by Adel al-Jubeir, the Saudi foreign minister, followed harsh criticism by Iranian leaders of the Saudis’ execution of Sheikh Nimr al-Nimr and the storming of the Saudi Embassy in Tehran by protesters in response.
Mr. Jubeir said that the kingdom would not allow Iran to undermine its security.
The supreme leader of Iran, Ayatollah Ali Khamenei, warned Saturday that Saudi Arabia would face divine vengeance for the execution of Sheikh Nimr, a day after protesters ransacked the Saudi Embassy in Tehran. Saudi Arabia, which put the cleric to death in a mass execution Saturday of 47 men accused of terrorism-related offenses, fired back, saying Iran had “revealed its true face represented in support for terrorism.”
The heated rhetoric underscored the mounting tensions between the two powers, each of which considers itself the leader of the Islamic world and supports opposing sides in conflicts across the region.
Setting off this round of recriminations was the execution of Sheikh Nimr, a Shiite cleric from eastern Saudi Arabia who often criticized the Saudi royal family and called for Shiite empowerment. Skeikh Nimr had become a leader in Shiite protests, and the government accused him of inciting violence.
Most of the reaction in the region to the execution broke cleanly along sectarian lines, with Shiite leaders in Iraq, Yemen, Lebanon and elsewhere criticizing the Saudis for killing a man they called a peaceful dissident while Saudi Arabia’s Sunni allies applauded what they called the country’s efforts to fight terrorism.
Most of the 47 executed had been convicted of being involved with Al Qaeda in a wave of deadly attacks in the kingdom a decade ago and included prominent leaders and ideologues. Four, including Sheikh Nimr, were Shiites accused of participating in violent demonstrations in which demonstrators and police were killed.
The BBC reported on Saturday that one of those executed, Adel Al-Dubayti, had been convicted of fatally shooting Simon Cumbers, a freelance journalist on assignment for the BBC in Riyadh in 2004. The attack also left a reporter, Frank Gardner, critically wounded.
Most of the men were beheaded; some were shot by firing squads. Unlike most Saudi executions, those on Saturday were not public.
Outside the Middle East, some criticized the Saudi justice system and the mass execution, the largest in the kingdom in decades.
Ban Ki-moon, the United Nations secretary general, said on Saturday that he was “deeply dismayed” by the execution of Sheikh Nimr and the other men after “trials that raised serious concerns over the nature of the charges and the fairness of the process.”
Zeid Ra’ad al-Hussein, the United Nations’ high commissioner for human rights, called the mass execution “a very disturbing development, particularly as some of those sentenced to death were accused of nonviolent crimes.”
Mr. Hussein, a Jordanian prince, also questioned whether due process had been observed during the men’s trials.
In the United States, Benjamin Rhodes, President Obama’s deputy national security adviser, refused to comment specifically on the execution of Sheikh Nimr but said the United States had been complaining to the Saudis for years about human rights issues.
“We also would like to see steps taken by Saudi Arabia and other countries to reduce sectarian tensions in the region,” Mr. Rhodes said.
The European Union, which opposes the death penalty, said that Shiekh Nimr’s execution in particular “raises serious concerns regarding freedom of expression and the respect of basic civil and political rights.”
Yet calls for restraint went largely unheeded in the Middle East.
“God’s hand of retaliation will grip the neck of Saudi politicians,” Iran’s supreme leader, Ayatollah Khamenei, said in comments reported on his official website.
“The oppressed scholar neither encouraged people to take armed action nor engaged in secret plotting,” he said of Sheikh Nimr. His “only action,” the ayatollah added, was “openly criticizing” the Saudis and “promoting virtue and prohibiting vice — something that stemmed from his religious ardor and devotion.”
The Iranians did, however, appear to be taking steps to prevent the dispute from escalating further. Forty Iranians were arrested in the anti-Saudi mayhem — a sign that the authorities were trying to contain public outrage.
Iran’s president, Hassan Rouhani, on Sunday also condemned the execution but said that the attacks on the Saudi Embassy in Tehran and on the Saudi Consulate in Mashhad had damaged Iran’s reputation.
“We do not allow rogue groups to commit illegal actions and damage the holy reputation of Islamic Republic of Iran,” he said in a statement. “What happened last night in Mashhad and Tehran and collateral damages in Saudi Consulate and Embassy is not acceptable and justifiable.”
He called upon the interior, judiciary and intelligence ministries to guarantee the safety of Saudi diplomats in Iran.
Saudi Arabia accused Shiekh Nimr of being actively involved in violence against security forces during Arab Spring protests in the east but has not released any evidence it may have against him.
The Saudi Foreign Ministry responded to Iranian criticism on Sunday by accusing Iran of “blind sectarianism” and of spreading terrorism “in the entire region.”
Hundreds of protesters gathered in front of the Saudi Embassy in Tehran on Sunday, chanting slogans against Saudi Arabia, the United States and Israel, but no violence was reported amid a heavy police presence. The protesters left the area after about two hours.
Tehran and Riyadh, the Saudi capital, already back opposing sides in the civil wars in Syria and Yemen and have vied for influence in Iraq, Bahrain, Lebanon and elsewhere.
Further straining tensions are Saudi concerns that the Iranian nuclear agreement could increase Tehran’s ability to spread its influence. Iran remains angry over Saudi Arabia’s handling of a deadly human crush during the hajj pilgrimage last year that left more than 2,400 pilgrims dead, according to a count by The Associated Press. More than 450 of the dead were from Iran.
Amid that hostility, some criticized the mutual recriminations.
“This spat between KSA and Iran is becoming ridiculous,” Michael Stephens, an analyst at the think tank Royal United Services Institute, wrote on Twitter, using a shorthand for the Kingdom of Saudi Arabia. “It’s like watching two children in the playground…pot calling kettle black.”
Both sides, Mr. Stephens wrote, accuse the other of abusing human rights, undermining Islam and cooperating with “the Jews and the West.”
“Pathetic,” he concluded.
Correction: January 3, 2016
Because of an editing error, an earlier version of a picture caption with this article misidentified the Saudi monarch whose picture was being burned. He is King Salman, not King Saud.