By Roger Hardy
BBC Middle East analyst
Iran played a crucial role in securing the recent ceasefire in the Sadr City area of Baghdad, just as it helped broker an earlier truce in the southern city of Basra.
Its role in curbing fighting between Iraqi Shia factions sheds a revealing light on the extent of its influence in the country.
It also appears that the Iraqi president, Kurdish politician Jalal Talabani, has been a key intermediary between the Iraqi government and the Iranians.
Phase One: Basra
The latest phase in the Shia power struggle in Iraq began in March when, without warning, Prime Minister Nouri Maliki sent his forces to break the power of the militias who had taken over Basra.
The Sadr City fighting has killed about 1,000 people, including many civilians
Their prime target was the Mehdi Army, the militia of the young Shia cleric Moqtada Sadr.
But in six days of fighting, the Mehdi Army managed to hold its own.
To the prime minister's embarrassment, hundreds of his troops deserted.
Iran, with its close ties to both the government and the Shia factions, intervened to end the violence.
According to a detailed report in the Christian Science Monitor, this followed an appeal from President Talabani to the commander of Iran's Quds Force, Brig Gen Qassem Soleimani.
US officials have accused the Quds Force - the external arm of the Iranian Revolutionary Guards - of arming and training Iraqi Shia militias.
Phase Two: Sadr City
The fighting in Basra eventually subsided, but the intra-Shia violence shifted to the Baghdad suburb of Sadr City.
The sprawling suburb is home to more than two million Shia and is the stronghold of the Mehdi Army.
The fighting was intense, lasting seven weeks and leaving up to 1,000 dead and many more displaced.
Government forces had the backing of US troops and US air power.
Despite the prime minister's tough talk, it looked as though he was unwilling to take the risky step of an all-out assault on Sadr City.
Once again, there was an appeal to Iran.
A delegation of Iraqi Shia politicians close to Mr Maliki went to Tehran, ostensibly to present the Iranians with evidence of their interference in Iraq.
But the unstated purpose was to seek Iran's help in ending the violence in Sadr City.
The fact that Moqtada al-Sadr is widely believed to be in Iran encourages the view that Iran may have some leverage over him.
The truce signed on Monday is fragile, but the episode is further proof that Iran can be very influential when it chooses to be.
A message to Petraeus
Even more intriguingly, the Christian Science Monitor reports a second meeting between President Talabani and Gen Soleimani, in early April.
According to the paper, the latter sent a message to the top American commander in Iraq, Gen Petraeus.
Its tone was surprisingly conciliatory.
"We must all work together - Iraq, Iran and the United States - to stabilise the situation," the Iranian general reportedly said.
More surprising still, he described Moqtada Sadr as "the biggest threat to peace in Iraq" and said his movement was "outside anyone's control".
It is hard to judge the significance of the message, and the Americans are said to be sceptical.
In public, there is no let-up in the hostility between Tehran and Washington, with each blaming the other for the violence in Iraq.
But what the whole affair illustrates is that Iran's ability to pull strings in Iraq is not to be underestimated.