Iran’s president, Hassan Rouhani, 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 the Islamic Republic of Iran,” he said in a statement. 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 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.” The European Union cited similar questions about “freedom of expression and the respect of basic civil and political rights.”

The Obama administration had appeared caught by surprise by the mass execution and scrambled at first to understand exactly who had been put to death. Privately several senior administration officials expressed anger at the Saudis, both for what one called “an apparent absence of due process” in the executions, and another for “negligent disregard” for how it could inflame the region. The officials spoke on the condition of anonymity because of the sensitivity of the diplomatic engagement with both countries.

The Saudi Foreign Ministry responded to Iran’s criticism on Sunday by accusing it of “blind sectarianism” and of spreading terrorism. Hours later, Mr. Jubeir, the Saudi foreign minister, announced the ending of diplomatic ties at a news conference in Riyadh, saying the kingdom would not allow Iran to undermine its security. “The history of Iran is full of negative and hostile interference in Arab countries, always accompanied by ruin, destruction and the killing of innocent souls,” he said. Analysts said the split could further destabilize the region.

“These countries don’t trust one another, and they see every event as an opportunity to raise tensions,” said Abbas Kadhim, a senior foreign policy fellow at the School for Advanced International Studies at Johns Hopkins University.