Earth-shaking demonstrations in Lebanon and Iraq have the political classes in both countries in retreat — and regional power Iran under pressure.

The big picture: Political offices in both countries are divvied up between religious and ethnic groups, but protesters claim the political factions have divided power and wealth among themselves at the expense of the citizens.

Iran has deep links to key players in both countries and has grown its influence enormously within the current systems.

Tehran thus sees the protests as a threat to its regional ambitions. Its leaders are also wary that they could inspire demonstrations in Iran itself.

Driving the news: Qassem Soleimani, head of the elite Quds Force of the Islamic Revolutionary Guard Corps, made a secret trip to Baghdad last week to prevent the ouster of Iraqi Prime Minister Adel Abdul-Mahdi, who had been under pressure to resign, Reuters reports.

While Mahdi remains in office, his Lebanese counterpart, Saad Hariri, has offered his resignation. Both leaders have been the targets of public anger.

Iraqi President Barham Salih promised electoral reforms in a televised address on Thursday. He wouldn't guarantee Mahdi would remain in office in an interview last month with Axios on HBO.

Despite the concessions made so far, protests continued in both countries over the weekend.

Zoom out: “Baghdad and Beirut’s fragile democracies were born of conflict: a devastating civil war in Lebanon, which pitted religious communities against each [other] and ended in 1990; and the power vacuum that followed the ousting of Saddam [Hussein],” FT notes.

“The consequence in both countries was the construction of complex, power-sharing political systems" that protesters claim "have become corrupted by the political parties they empowered, preventing effective governance and frustrating citizens demanding better standards of living.”

Zoom in: Some protestors are specifically targeting Iranian influence.

The Iranian consulate in the Iraqi Shiite holy city of Karbala was attacked on Sunday, with protestors accusing Iran of "propping up the ‘corrupt, inefficient’ government they want to overthrow,” the Telegraph’s Josie Ensor reports.

“In recent days, they have been seen burning posters of Iranian Supreme Leader Ayatollah Ali Khamenei, which would have been unthinkable before the recent protests began last month.”

“Militias backed by Tehran have tried to help put down the rallies, which are growing in scale, deploying snipers and firing on unarmed demonstrators," Ensor writes.

That violence has only spurred further outrage over Iranian influence.

What they're saying: Khamenei claimed in a speech that "the U.S. and Western intelligence agencies, with the help of money from regional countries, are instigating unrest in the region." He urged authorities in both countries to "stabilize these security threats.”

The Trump administration has for years denounced Iran's regional influence, but has been relatively restrained in the face of the recent protests.

"That may be the wisest path to take," writes the WashPost's Ishaan Tharoor, "given Tehran’s eagerness to dismiss these seemingly indigenous, nonsectarian movements as the product of American malfeasance."

Go deeper: One year of "maximum pressure" on Iran