A stable Iraq is vital for Iran while Washington needs Iraq to keep Iran's regional influence in check
Iraq's deadliest wave of protests since the 2003 ouster of dictator Saddam Hussein has made the country vulnerable to a battle for influence between its two main competing allies, the United States and Iran, analysts say.
The anti-government protests that erupted on October 1 echoed the demands that young Iraqis have made over recent years.
But the demonstrations played out differently this time, as tensions spiralled between the US and Iran.
"Without this context, Iran would not have intervened," Iraqi political analyst Munqith Dagher said.
Tehran denounced the week of demonstrations that shook Baghdad and southern Iraq as a "conspiracy" that "failed".
This response cost Iran "a lot of credit and support in Iraq, especially among Shiites," said Dagher.
"But it sacrificed that in order to maintain the system in place in Iraq and to guard the country as an asset in negotiations with the United States."
The wave of unrest left more than 100 people dead, mostly protesters, and put Prime Minister Adel Abdel Mahdi in a weaker position than ever.
Even before this Abdel Mahdi headed an unwieldy government.
The coalition includes Shiite populist cleric Moqtada al-Sadr -- who won the most seats in the last parliamentary elections -- and Fatah, the political arm of Hashed al-Shaabi, the paramilitary force dominated by pro-Iran groups.
As protests peaked, Sadr called for the government he helped form to resign.
The Hashed took the opposite position, saying it was ready to crush the "conspiracy" aiming to bring down the government.
Since then state institutions have been paralyzed by division, effectively preventing concrete responses to protester demands for jobs, services and ending corruption.
Caught in the middle, Abdel Mahdi is "even weaker and more vulnerable to pressure from the largest political blocs," said Maria Fantappie, an International Crisis Group Iraq analyst.
This could favour Tehran, she said, as "the prime minister will be increasingly dependent on Iran's ally Fatah, which has stood by his side during the crisis".
Polarization is complicating the premier's pursuit of "a foreign policy aimed at insulating the country from the unfolding US-Iran competition," Fantappie said.
But in a crisis-ridden and increasingly fractured region, a country like Iraq -- which attempts to maintain relations with all, from Iran to the United States, Saudi Arabia to Syria -- is a major asset for all.
Neither Washington nor Tehran "would like to see the situation spin out of control," Fantappie said.
A stable Iraq is vital for Iran. Stifled by US sanctions, Tehran is committed to maintaining its six billion euro ($6.6 billion) annual exports to Iraq.
Likewise Washington needs Iraq to contain the danger of a resurgent Islamic State group, and to keep Iran's regional influence in check.
The danger now, Fantappie said, is that some in the US administration interpret anti-Iran slogans by protesters as evidence of mounting anti-Iranian sentiment overall.
US officials who see Abdel Mahdi as indecisive and powerless may even push to replace him in light of the demonstrations, she said.
But this "could be like opening a Pandora's box, given a stagnating political system, mounting popular frustrations and the perennial difficulty of forming a government" in a country caught between rival powers.
The shifts in Iraq's political arena go beyond the pro-US and pro-Iran camps -- other factions have also made moves since the start of the month.
Firebrand Sadr maintains the ability to paralyze the country with sit-ins -- as he has done in the past.
Grand Ayatollah Ali Sistani, Iraq's highest Shiite spiritual leader, said in his sermon Friday that he "had no interest in any party in power" and only defended "the interests of the people".
Even as calm appears to have returned to Iraq, the protests may yet be rekindled, particularly if public anger grows as videos showing last week's crackdown continue to circulate online.