The protest wave began, according to Iranian sources, in the city of Mashad, and was originally organized by hard-line clerics – rivals of President Hassan Rohani who sought to capitalize on the unrest over unemployment and high prices. If this was indeed the motivation, it seems to have backfired, with protests quickly spreading to dozens of cities across Iran and now targeting not only the relatively “moderate” Rohani government but the more hard-line establishment around Supreme Leader Ali Khamenei and his allies, including the Revolutionary Guards.

To really understand the Middle East - subscribe to Haaretz

One of the many slogans being heard at the protests is “No Gaza, No Lebanon, No Syria, My life for Iran!” – referring apparently to the billions Tehran has spent on its allies across the region, instead of investing in the stagnant economy at home.

It’s ironic that the protests, which were planned by Rohani’s hard-line rivals to pressure him, have backfired in such a way. In recent months, one of the major behind-the-scenes debates in the Iranian establishment has been whether to make a further major investment in Syria. As the Syrian civil war seems to be dying down, the Revolutionary Guards have sought to capitalize on the money they spent there and entrench their presence by building a permanent air base and docking facilities on the Mediterranean coast. This would mean spending at least hundreds of millions more, if not billions, on construction.

According to Western intelligence sources, the factions close to Rohani are against spending this money they say is needed for improving infrastructure and providing jobs at home. The debate taking place behind closed doors in Tehran seems to have spilled out onto the streets of Iran’s cities.

Open gallery view In this photo taken by a person not employed by AP and obtained outside Iran, university students protest at Tehran University while a smoke grenade is thrown by riot police, December 30, 2017. Credit: AP

Iraq and the Arabian Peninsula

The extent of Iran’s funding for its allies and proxies in the region is impossible to assess accurately, in part because much of the funding comes in the form of arms and equipment, as well as the transport of fighters and supplies in aircraft operated by Iranian state-owned airlines. Iran extends invaluable support to its allies also through the services of its officers as military advisers and by setting up Shi’ite militias that it trains and deploys across the region.

Iran in recent years has invested billions in propping up its allies in Lebanon, the Gaza Strip, Yemen, Iraq, Saudi Arabia and Bahrain, but above all, since 2011, it has poured money in keeping Syrian President Bashar Assad in power.

Iran’s investment in the Assad regime over the past six and a half years has come in various forms and is difficult to quantify. Iranian state-owned banks set up credit lines for the Syrian government of $3.6 billion in 2013 and $1 billion in 2015 to let the regime buy oil and other goods from Iran.

The $4.6 billion does not include arms supplies, arriving daily in Iranian cargo aircraft at the Damascus airport, the deployment of thousands of military “advisers” of both Iran’s army and Revolutionary Guards – a thousand of whom are estimated to have been killed in action – and the much larger force of Shi’ite militias, mainly fighters from Afghanistan that Iran has organized and funded. Around 50,000 of these militia members have fought in Syria. They earn $300 a month, and Iran also pays for their weapons, travel and sustenance. In other words, Iran has spent billions more annually on the Assad regime over the last six years.

Open gallery view File photo: Iran's army chief of staff Maj. Gen. Mohammad Bagheri in the northern province of Aleppo, Syria on October 20, 2017. Credit: Uncredited/AP

Around 100,000 Iranian-backed militia fighters have been operating in Iraq in recent years, both fighting the Islamic State and furthering Iran’s interests in neighboring territory. Though part of the funding for these militias comes also from Iraqi sources, the lion’s share of their pay and weaponry is financed by Tehran.

The Hezbollah model

Of course, of all the Shi’ite militias in the region, the one that has gained the most from Iran’s largesse is Hezbollah. Estimates of Iran’s funding for the Lebanese group reach anywhere from $60 million to $1 billion a year. It comes in the form of direct financial support, massive quantities of both basic conventional arms and advanced weapons systems, training facilities in Iran, and investment in construction projects in Lebanon to boost Iran and Hezbollah’s standing in the country.

The model that Iran pioneered in Lebanon from the mid-1980s, of training and arming Hezbollah as its local proxy, has been replicated with anti-government Shi’ite underground groups in Saudi Arabia and Bahrain, and militias in Iraq since the U.S. invasion in 2003 and the Houthis in Yemen since at least 2015. In their case, the aid has come in the shape of long-range missiles as well, which the Houthis have been firing at Saudi Arabia, including Riyadh.

Not only Shi’ite groups have received arms and funds. Israeli intelligence has assessed the financial support to Islamic groups in Gaza at around $100 million annually, though this decreased since the beginning of the Syrian civil war, when Hamas, which was close to the Sunni rebel groups in Syria, temporarily cut its ties with Iran and the Assad regime. Over the last two years, those ties have been reestablished and the financial support for Hamas is now at around $50 million, while the more radical Islamic Jihad, which did not cut ties with Tehran, is receiving around $70 million.

Open gallery view A Palestinian Hamas militant takes part in a rally marking the 30th anniversary of Hamas' founding, in Gaza City December 14, 2017. REUTERS/Suhaib Salem TPX IMAGES OF THE DAY Credit: REUTERS/Suhaib Salem

The Revolutionary Guards, who have supervised these investments, have tried to make at least some of them profitable. Syria used much of the credit to pay for Iranian oil and gas, which Iran had no customers for when it was under sanctions and support for the Assad regime was given in part in return for mining rights in Syria and the lease of land for agriculture. But it will take time, probably years, until matters in Syria have calmed sufficiently for the Iranians to see any profits.

The Iranian nuclear deal, which ended most of the sanctions on Iran, has unfrozen tens of billions of dollars that have reached the regime’s coffers but have yet to be translated into prosperity trickling down to the Iranian people. The hard-liners’ attempt last week to channel the frustration with Rohani, whose government led the nuclear talks, seems to have resulted in an outburst of anger also at the hard-liners’ investment of billions that Rohani was less in favor of.

Either way, it could be bad news for both rival sections of the Iranian leadership. Once you push people out on the street, it becomes very difficult, if not impossible, to direct their fury.