Why Iran has finally let go of Maliki
Less than two months ago, Iran's Supreme Leader, Ayatollah Ali Khamenei, spelled out his position on Iraq.
Iran was against US intervention, he said, and the world should respect the results of Iraq's April election which saw victory for Nouri Maliki's alliance.
But the ayatollah has been overtaken by events.
The past week has seen the US launch air strikes against Islamic State (IS) militants in northern Iraq, while in Baghdad Mr Maliki has failed in his bid to return to the prime minister's office.
Although this all goes contrary to Iran's stated wishes, officials in Tehran have said almost nothing.
"Iran's silence shows they are happy with what's happening in Iraq," says Ghassan Attiyah, president of the Baghdad-based Iraqi Foundation for Development and Democracy.
Mr Attiyah says that Iraq's new Prime Minister Haider Al-Abadi has strong ties to Iran and for this reason the Iranians have not tried to block his nomination.
"They were not happy with Maliki from the beginning but they accepted him because the Shia bloc supported him in parliament," he says.
"But when he started losing and alienating Kurds and Sunnis, Iran didn't like it."
Change in tone
Iran has also confounded expectations that it would issue an angry condemnation of the US air strikes this week on IS positions in northern Iraq.
In fact, in a striking change of tone, an advisor to Iranian Foreign Minister Mohammad Javad Zarif said on Monday that Iran and the US should work together to counter IS in Iraq.
Observers say the realisation that the militants are now just 25km (16 miles) from Iran's western border may well have influenced thinking in Tehran.
It is clear that the threat posed by the Islamic State is another factor in Iran's decision not to actively oppose the appointment of Mr Abadi as Iraq's new prime minister.
Unlike US President Barack Obama, Iran's president has yet to congratulate Mr Abadi on his appointment.
But in a phone call on Monday to congratulate another newly elected leader in the region, Turkey's Recep Tayyip Erdogan, Iranian President Hassan Rouhani said a government must be formed in Iraq "as soon as possible", and that Iran would support "the person who is approved by the majority of Iraqi lawmakers".
It was the first clear indication that Iran was not intending to stand firmly behind Mr Maliki as it has done for its other regional protege, Syrian President Bashar al-Assad.
There was more bad news for Mr Maliki on Tuesday when the secretary of Iran's Supreme National Security Council, Ali Shamkhani, also voiced support for the move in Baghdad to choose a new prime minister.
Mr Shamkhani's call for all Iraqi groups and coalitions to keep united and work together to protect national unity seemed like a coded message to Mr Maliki that his time was running out.
The hardline Javan newspaper, affiliated to Iran's Revolutionary Guard, adopted a similar tone.
In an editorial, it called on him to show "selfless compliance" to the Iraqi president's decision.
The final nail in the coffin was Ayatollah Khamenei lending his support to Mr Abadi's appointment on Wednesday.
"I hope the designation of the new prime minister in Iraq will untie the knot and lead to the establishment of a new government and teach a good lesson to those who aim for sedition in Iraq," Ayatollah Khamenei said in a speech to foreign ministry officials and diplomats.
"Maliki won't leave easily," says Mohsen Milani, the Iranian-born director of the Center for Strategic and Diplomatic Studies in Florida.
"But if both Iran and the US support the new government, he has to go."
Mr Maliki said Mr Abadi's nomination was a "violation of the constitution" but for Iran what is important at the moment is to see a unified Shia bloc in Iraq and a new government formed without further delay.
And if Mr Maliki cannot deliver either of these things, then as far as Iran is concerned, his time is up.