As governments in Iraq and Lebanon stagger and stumble under huge waves of popular protest, powerful factions loyal to Iran are pushing to quash political upheaval which challenges Tehran's entrenched influence in both countries. Lebanon's Prime Minister Saad Al-Hariri has resigned and the government of Iraq's Prime Minister Adel Abdul Mahdi has been pushed to the brink of collapse. Both governments have enjoyed backing from the West. But they have also relied on the support of political parties affiliated with powerful Iran-backed Shiite armed groups, keeping allies of Tehran in key posts. That reflects the relentless rise of Iranian influence among Shiite communities across the Middle East, since Tehran formed the militant group Hezbollah in Lebanon in 1982 and after Saddam Hussein was toppled in Iraq in 2003. Both Iraq and Lebanon have government systems designed to end sectarian conflict by guaranteeing a share of power to parties that represent different communities. In both countries, leading Shiite groups are closely associated with Iran, and have held on to weapons outside the official security forces. Protesters are now challenging those power structures, which Iraqis and Lebanese blame for corruption, the dire state of public services and the squandering of national wealth, which Iraq brings in from oil and Lebanon from foreign backing. Unusually in both countries where sectarian parties have previously dominated politics, most protesters are not linked to organized movements. In both countries they have called for the kind of sweeping change seen in the 2011 Arab uprisings, which brought down four Arab leaders but bypassed Lebanon and Iraq. In Lebanon, demonstrations flared in late September against bad economic conditions as the country grappled with a deepening financial crisis. Nationwide protests broke out two weeks later against government plans to raise a new tax on calls using popular mobile phone software such as WhatsApp. In Iraq, demonstrations began in Baghdad and quickly spread to the southern Shiite heartland. In Iraq, the protests have taken place on a scale unseen since Saddam's overthrow, with sweeping demands for change. The authorities have responded with a violent crackdown which left more than 250 people dead, many killed by snipers on rooftops firing into crowds. "The fact that you were seeing that level of mobilization makes the protests more dangerous in the perception of the political elite," said Renad Mansour, Iraq analyst at London-based Chatham House. The mainly Iran-backed militias view the popular protests as an existential threat to that political order, Mansour said. In Lebanon, the demonstrations come at a time of economic crisis widely seen as the worst since the 1975-1990 civil war. If Hariri's resignation prolongs the political paralysis it will jeopardize prospects of rescue funding from Western and Gulf Arab governments. Hezbollah leader Hassan Nasrallah initially addressed the Lebanon protesters sympathetically, echoing Hariri's conciliatory stance, before changing tone and accusing foreign powers of instigating the unrest. People loyal to Hezbollah and the Shi'ite movement Amal attacked and destroyed a protest camp in Beirut. Hariri announced his resignation shortly afterwards despite pressure from Hezbollah, widely seen as the most powerful player in Lebanon, not to concede to the protests. In the absence of an obvious replacement for Hariri, Hezbollah, which is under US sanctions, faces a predicament. Although Hezbollah and its allies have a majority in parliament, they cannot form a government on their own because they would face international isolation, said Nabil Boumonsef, a commentator with Lebanon's an-Nahar newspaper. "It would be the quickest recipe for financial collapse. The whole world will be closed to them." In Baghdad, Abdul Mahdi's government was saved for now after apparent Iranian intervention. Reuters reported this week that Qassem Soleimani, the head of the elite Quds force of Iran's Revolutionary Guards, which sponsors Tehran's allies abroad, flew to Baghdad for a secret meeting at which a powerful Shi'ite party agreed to keep the prime minister in office. Iraqi security officials have said that snipers who shot down from rooftops at crowds last month were deployed by Iran-backed militias. While Shi'ite militia forces project unambiguous power, Iran's political weight is often deployed behind the scenes. In Lebanon, a longstanding accord on power-sharing means no single confession can dominate state institutions. For all its prominence, Hezbollah picked only three ministers in Hariri's last Cabinet. "A winner-takes-all mentality just does not work in Lebanon," said Nadim Houry, executive director of the Arab Reform Initiative, who said Hezbollah may have miscalculated by employing "scare tactics" against the protesters. "This goes against the grain of Lebanese politics. They are going to have to compromise." In Iraq too "Iran has more influence than any other country ... but it doesn't have control over what happens there," says Crisis Group's Iran project director Ali Vaez. In Iraq it is too early to say. Tehran's main rival, the United States, has so far kept mostly quiet on the protests, probably waiting to see the outcome. In Lebanon, which urgently needs outside funding to keep its economy afloat. Before he quit, Hariri failed to convince foreign donors to release $11 billion in aid pledged last year, in part because of Hezbollah's prominence. Two US officials said this week that President Donald Trump's administration is withholding $105 million in security aid for Lebanon.