Turmoil in Baghdad, paralysis in Beirut and flames of unrest in Tehran; it has been a bad few months for Iran at home and elsewhere in the Middle East, where more than a decade of advances are being slowed, not by manoeuvrings on battlefields or legislatures – but the force of protest movements.

Early last week, Iran went dark for four days by closing its internet connections down. Even for the country’s autocratic leadership, this was a drastic step. But such are the stakes for a regime that is increasingly facing obstacles across its hubs of Shia influence. And those who laud Iran’s rise, as well as those who fear it, sense it is at a loss over how to respond.

The reaction to relentless anti-government protests in Iraq, which along with Lebanon is essential to Iran’s foreign projection, has so far been straight from a well-worn playbook. The initial weeks of the popular uprising were met with placatory speeches from Iraqi leaders, and a passive stance from security forces. But that changed in late-October and, since then, more than 300 people have been killed and thousands wounded as Iraq’s leaders – directed by Iran’s generals have changed tack.

Gone is any notion of compromise. Instead, the din of bullets, grenades and sirens have become a soundtrack to demonstrations in Baghdad demanding the overthrow of the entire political system. While the protests are aimed at domestic issues – the insatiable graft of its leaders and widespread lack of opportunities for the young central to them – the post-Saddam years have seen Iran embed itself in nearly all aspects of Iraqi governance.

Its role as overlord has also raised the protesters’ ire – just as it has in Lebanon, where Iran’s most important arm of its foreign policy projection, Hezbollah, plays a dominant role in the country’s affairs.

Since the US-led invasion that ousted the Iraqi leader and especially since the withdrawal of US forces from Iraq in 2011, Iran had methodically consolidated itself in both countries. The war in Syria gave its regional gains even more impetus, as did the war against Isis, which allowed its proxy forces to establish footholds in the plains of western Iraq and eastern Syria as they helped defeat the terror group.

As Isis crumbled from late 2015, each area became a platform for a regional project that would finally allow Iran to fulfil long-held ambitions to consolidate a presence on the shores of the Mediterranean and the northern frontier of Israel. Iran took a stake in the Syrian port of Latakia, established a toehold on the Syrian Golan Heights, and an overland supply line from Tehran through the ruins of Iraq and Syria and onwards to Lebanon.

Friend and foe alike saw the developments as a priceless strategic gain for Iran’s projection towards Israel and influence in the Arab world. Proxies in Baghdad and Beirut were not shy in touting what the land corridor meant for Iran’s ambitions. “This has established a historical presence for the Islamic Republic on Arab soil that will change the course of the region,” a senior member of the Iraqi militia, Asa’ib ahl al-Haq, told the Observer in late August. “The Zionists know this, and they fear it.”

Regional intelligence officials and Iraqi militia leaders say the overland route itself is a mish-mash of roads along the Iraqi/Syrian border, where a firm road is yet to be carved. Israeli airstrikes in the area have proven disruptive as have the chaotic departure – then re-arrival – of US troops, and the still simmering presence of Isis. Beyond the border area though, the paths to Damascus and west to Beirut, or northwest to Latakia are less problematic. “It becomes harder to monitor where things go from there,” said an official in Baghdad.

Over the past eight years, western diplomats have continually wrestled with what the unravelling of Syria meant for Iran, and for Hezbollah, which has played a prominent role in stabilising Bashar al-Assad since early 2013. Under the direction of Major General Qassem Suleimani, of the Iranian Revolutionary Guards, Hezbollah and Shia militia proxies from Iraq, Yemen, Afghanistan and Pakistan swung the war in Assad’s favour, strengthening Iran’s arc of influence. By earlier this year, Iran held a whip hand in four capitals outside Tehran, and was building even further momentum.

But Donald Trump’s decision earlier this year to overturn the nuclear agreement, the signature foreign policy deal of Barack Obama, and reimpose even tougher sanctions on Tehran marked a seminal moment. The sanctions regime amounted to an economic war, which many on the Iranian street railed against as a grave injustice imposed by a capricious foe who only several years earlier had wanted to do business.

With Iran’s economy now withering, some Iranians having revolted at a fuel price hike. And with its sources of projected influence under pressure elsewhere, Iran’s leaders are facing a reckoning, perhaps like no other in the post-Saddam period. Its gains, for now, remain secure.

“I’d say that Iran has undoubtedly used the chaos in Syria to strengthen its control over the strategic routes leading to Lebanon,” said one western diplomat. Syria has allowed Iran to make enormous progress in terms of military capacity transfers. For Hezbollah Syria has become a sort of backstage storage for sensitive military equipment.

Sir John Jenkins, one of Britain’s longest-serving regional ambassadors, who led missions in Baghdad, Riyadh, Damascus, and East Jerusalem, said: “There was a time when Iranian pretensions to defend the oppressed and punish the corrupt resonated more widely in the region. But what is left is only a distant, fading echo of this – as many Shia scholars warned would happen. We see the consequences in the reactions of Iraqi, Lebanese and now Iranian Shia protesters who are tired of being instrumentalised and want a better life now not in some Khomeinist paradise.

Iran can impose its will now only by massive violence. That might still work for the moment. And the regime has revolution-proofed itself by the construction of an interlocking system of praetorian guards. But the community of true believers is shrinking. Just look at religious observance inside Iran. It’s collapsed. And any real moral authority that the revolution might once have had is gone.

“Syria was a massive turning point. Iraq is another now. And we’re beginning to see protesters talk to each other across national boundaries. It’s a process of erosion. The last true believers are probably those on the European left who think Iran is a bastion against US neo-liberal orientalist-inflected neo-colonialism. That says it all.

“Iran has become normalised – just another repressive Middle Eastern state ruled by greedy self-serving elites who can’t even imagine let alone countenance what peaceful political evolution would look like.”

In Lebanon, where a cross-sectarian movement has taken to the streets as the country’s economy collapses around them, the narrative that the government and its patrons abroad supports their aspirations has broken. Under grave pressure too is a political system that has sustained a weak state, now exposed as untenable. In Beirut and Baghdad, protesters appear to have crossed a point of no return; they have more to lose by leaving the streets than they do by staying there.

The western diplomat said: “This is something Iran has never faced before. How it responds will determine whether its achievements survive.”