Iran's role as the Middle East's most consequential power has been cemented by its support for President Bashar al-Assad in Syria, for the Shiite militias in Iraq fighting the Islamic State, for the Houthi rebels in Yemen and for the Hezbollah movement in Lebanon.
But the interventions have been costly and, as the demonstrations have revealed, unpopular — at least with some Iranians.
"No Gaza, no Lebanon, our lives for Iran," the crowds chanted at one of the first demonstrations, a reference to Iranian support for the Palestinian Hamas movement in Gaza and for Hezbollah in Lebanon. "Leave Syria alone, think about us," and "Death to Hezbollah" were among other slogans.
These are a reminder that Iran's power plays in the region have come at a price, according to Mohamad Bazzi, a professor of journalism at New York University who is writing a book about Iran's role in the region and its rivalry with Saudi Arabia.
"For the past few months, if not years, Iran has been viewed as ascendant. They've been, quote, winning in the Middle East," he said. "And now we find out Iranians don't approve of their government spending all this money in places like Lebanon and Syria."
With the anti-government protests apparently starting to fade, there is no reason to anticipate any immediate changes to Iranian policies, either foreign or domestic. For a third straight day on Friday, the authorities organized pro-government demonstrations in numerous Iranian cities, seeking to underline their message that the anti-government protesters represented a tiny minority of Iranians whose actions had been instigated by Iran's foreign enemies, notably the United States, Israel and Saudi Arabia.
The spread of the anti-government protests over the past week nonetheless suggests a level of domestic unhappiness that calls into question whether Tehran's regional ambitions can be sustained, said Fawaz Gerges, professor of Middle East politics at the London School of Economics.
"Before the protests, you had this dominant narrative that Iran is unstoppable, Iran is undefeatable, Iran is as solid as a rock," he said. "The protests have undermined the posture of the Islamic Republic in the region, as the unrivaled superpower."
"Thousands of protesters have exposed a major rupture in Iranian society, not just between reformists and ultraconservatives but between a critical segment of Iranian public opinion and the leadership," he said. "This is really why this particular moment matters a great deal."
Exactly how much Iran has spent on its foreign interventions is unknown, said Sanam Vakil, who analyzes Iran at London's Chatham House think tank. One of the triggers for the demonstrations, she said, appears to have been the recent unveiling of the country's 2018 budget by President Hassan Rouhani. It featured, among other unpopular items, a big jump in funding for the powerful Islamic Revolutionary Guard Corps, to about $8 billion — almost two-thirds of the defense budget, according to Iranian news reports.
The IRGC oversees the Quds Force, labeled a terrorist organization by the United States, which has overall responsibility for promoting Iran's vision of revolutionary Shiite Islam in the region. The group is commanded by the legendary warrior Qassem Soleimani, who has repeatedly been pictured at the front lines of the region's wars in photographs on Instagram and Twitter. This strategic portrayal broadcasts Iranian influence on the outcome of battles from Aleppo in Syria to the small town of Jurf al-Sakhar south of Baghdad.
The IRGC also controls extensive business interests that amplify its income while obscuring the true cost of Iran's foreign interventions, Vakil said. "A lot of money is spent that is not accountable. It's a black box, and the government doesn't publicize it."
The budget featured big sums for some of Iran's religious foundations, and the protests appeared to be rooted as much in resentment over local issues, such as corruption and income inequality, as in specific concerns about the country's foreign interventions.
But there is no question that spending billions of dollars on other countries' wars clashes with the reality of dwindling living standards in Iran, said Alireza Nader of the Rand Corp.
"They're completely overstretched," he said of the Iranian government. "On the surface, they seem to be doing pretty well and winning these conflicts, but they're spending money they don't have."
Iran's leadership has until now seemed oblivious to any potential contradiction between its role in fighting the region's wars and its standing with ordinary citizens. Rather, leaders have repeatedly trumpeted the gains they have made.
The surprise challenge to Iran's role could trigger a shift in perceptions even if there is no immediate policy change, said Paul Salem of the Middle East Institute in Washington. "This will make Iran's allies and proxies nervous and feeling vulnerable."
In comments aimed at reassuring Hezbollah's supporters in Lebanon, the group's leader, Hassan Nasrallah, told the Lebanese television network Al-Mayadeen on Wednesday that there is no reason to fear a loss of Iranian funding. Even if Iran were to find itself unable to continue funding Hezbollah, he added, ordinary Iranians would dig into their pockets to do so.
"There is nothing to worry about," he said. "The size of the protests is not large."
The size of the protests may matter less, however, than the issues the protesters have raised, Gerges said: "They have exposed the fragility of the Islamic Republic."
Suzan Haidamous contributed from Beirut.