Within hours of the execution, nationalist Iranian websites were calling for demonstrations in front of the Saudi mission in Tehran and its consulate in the eastern Iranian city of Mashad. The police, outnumbered, looked the other way as angry protesters set the embassy ablaze with firebombs, climbed the fences and vandalized parts of the building.
Now, Iranian leaders are suddenly forced to reckon with whether they played into the Saudis' hands, finding themselves more isolated and in crisis at a time they had been hoping to emerge from international sanctions as an accepted global player.
"They knew we couldn't look the other way," said Fazel Meybodi, a cleric from the Iranian holy city of Qum, one of the world's main centers of Shiite theology. "That they would actually go ahead with killing him? That caught all of us by surprise."
After the embassy attack, Saudi Arabia officially severed diplomatic ties with Iran, and Bahrain and Sudan followed suit on Monday. The United Arab Emirates, one of Iran's most important regional trading partners, decided to downgrade its relations.
The moves formalized the Sunni-Shia polarization that has fueled the chaotic proxy wars and maneuvering across the Middle East.
And they seemed to put pressure on the United States and other Western nations to choose between their Saudi allies or the Iranians right at a time when those countries had been more closely engaging with Iran in hopes of easing the war in Syria.
Just in December, the Saudi and Iranian foreign ministers sat directly across from each other during a high-level meeting in New York to talk about Syria. Direct talks among the warring parties in Syria, overseen by a U.N. mediator, Staffan de Mistura, are scheduled to start on Jan. 25 in Geneva. There was little clarity before about who would represent either the Syrian government or the various opposition groups fighting it, and now, after the diplomatic schism, there seemed to be even more confusion.
U.N. Secretary-General Ban Ki-moon spoke by phone on Monday with the foreign ministers of Saudi Arabia and Iran, condemning both the execution of al-Nimr and the attack on the embassy in Tehran. Ban - who has repeatedly urged the two countries to cooperate on regional conflicts - called the break in Saudi-Iranian relations "deeply worrying."
Iran sent a letter to Ban saying it had taken "necessary measures, including the increase in the number of security forces," to protect the Saudi mission, adding that 40 protesters had been arrested.
Some Iranian officials had hoped that January would become a celebration of Iran's growing importance.
After years of hard negotiations, sanctions over Iran's nuclear program were to be lifted. Once the nuclear deal is implemented, "Our great people will experience peace and the opening of the country's economy to the world," President Hassan Rouhani promised in a speech to the nation December. Some "reactionary" countries in the region had tried to block the nuclear agreement, he said, hinting at Israel and Saudi Arabia. "But they have failed."
Now, some Iranians are wondering whether Saudi Arabia has again gained the upper hand in the new diplomatic crisis.
"Saudi Arabia killed Mr. al-Nimr at this sensitive juncture in time to widen the gap between Sunni and Shiite Muslims," said Meybodi, the Iranian cleric in Qum. "Unfortunately they had predicted our overreaction, and now they are using it against us to try to isolate Iran once again."
Al-Nimr was not only a leading opposition figure in the Saudis' Sunni kingdom but also a symbol of Shia activism abroad. After he was sentenced to death by the Saudi judiciary in 2014, Iran warned of "dire consequences" if al-Nimr were to be executed.
Beyond al-Nimr's case, however, there have been several flash points between Iran and Saudi Arabia in recent months, with the nuclear deal and the wars in Syria and Yemen driving most of the tension.
Within Iran, there was also intense anger over the Saudis' handling of the annual pilgrimage to Mecca. Before the summer, Iranian officials temporarily halted pilgrimages to the holy city after accusations that Saudi security officials had sexually abused two Iranian teenage boys. Then, in September, hundreds of Iranians were among those killed in a stampede by pilgrims near Mecca.
Saudi opposition to the nuclear deal and lifting of sanctions again Iran has driven more hard feelings here. Many Iranians were quick to point out Saudi Arabia's alignment of interests with Israel, a hated enemy.
"Both countries are opposed to the nuclear deal, both want it to fail," said Hamid Reza Taraghi, a political analyst and conservative politician. "During the nuclear talks we witnessed John Kerry shuttling between Israel and Saudi Arabia, hoping to appease both of them. We know of the secret trips of Saudi officials to Israel. Their only goal is to limit Iran, which of course they are unable to do."
Some of the Iranians who rioted at the Saudi Embassy said they had friends fighting against Saudi-backed extremist groups in Syria.
"We shouted: 'Death to the house of al Saud!'" said Abolfazl, one of the protesters, who refused to give his family name out of fear of punishment. "We showed our anger and threw whatever we could find. There were police, but there were too few."
Iran's own internal tensions are playing out in the crisis, as well.
There was far from universal support within Iran for the nuclear deal, which some criticized as giving away too much to foreign interests. Now, with parliamentary elections scheduled for February, and with an upcoming election of the clerical council that in theory will choose the next supreme leader, the hard-liners are sure to use the issue, and the crisis with Saudi Arabia, to pummel allies of Rouhani and others who favored the nuclear deal.
"What group here in Iran benefits politically from storming an embassy?" a former member of the Iranian National Security Council, Aziz Shahmohammadi, asked rhetorically. He was suggesting the answer lay with the hard-liners - a loose alliance of clerics, ideologues and military commanders. "Such people are even against foreign soccer coaches to train our teams."
The embassy attack played into their agenda of opposition to Rouhani, whom Shahmohammadi said was clearly blindsided by the riot.
"For them this might lead to electoral gains, an example that Iran is better off isolated. But they are missing the big picture here: We need and want peace and calm," he said.
The act of cutting ties seems a simple one, but the consequences can be far-reaching. "We are moving increasingly towards conflict," Shahmohammadi said.
"This is bad for the entire region - in Syria, in Yemen, and to a lesser extend in Lebanon and Iraq as well," he added. "Cutting ties is fanning the flames in a region already on fire."