Maliki says he has accepted the candidacy of Haider al-Abadi, nominated by the president to form a government

Nouri al-Malki, the embattled prime minister of Iraq, announced on Thursday that he was stepping down after support from his party and associates in parliament slipped away.

In a speech, Iraq’s two-term leader Maliki said that he accepted the candidacy of Haider al-Abadi, nominated last week by the Iraqi president to form a government.

Maliki had been struggling for weeks to stay for a third four-year term as prime minister amid an attempt by opponents to push him out, accusing him of monopolising power and pursuing a fiercely pro-Shiite agenda that has alienated the Sunni minority.

The pressure intensified this week when his Shiite political alliance backed another member of his party, Abadi, to replace him, and President Fouad Massoum nominated Abadi to form the next government.

Maliki for days has refused to step aside, saying the nomination violates the constitution. But in a meeting of his Dawa party on Thursday evening, Maliki agreed to endorse Abadi as the next prime minister. The former leader is understood to be seeking indemnity from any prosecution, as well as a role in the new government.

By stepping aside, Maliki ends his legal challenge to al-Abadi’s nomination as leader, which he had launched earlier in the week after learning that he would not be asked by new President, Fouad Massoum to form a government.

With his announcement, Maliki was bowing to the inevitable. He had lost the support of his party, of the president, the parliament, the Americans, Saudis and finally the Iranian government, his biggest foreign ally and sponsor. Even the Iranian Supreme Leader, Ali Khamenei, issued a statement pointedly welcoming the appointment of Abadi.

But the confirmation of a new prime minister is only a small - albeit essential – step towards the huge task now facing the new government in Baghdad, which must knit the country back together again following its spectacular and violent unravelling this year. National cohesion will take a lot longer to recreate that it did to lose. The tribal structures of the Sunni population, which would have to be the building blocks of national reconstruction, have been severely damaged by Isis brutal sweep through the country.

Abadi however, has the great advantage of not being Maliki, whose narrow sectarian approach to government and brutal methods, made him a hate figure for Sunnis, and ultimately a liability for the Iraqi Shia and for Iran.

Like his successor, Maliki rose from obscurity to power, in large part due to the frustration of the US with existing prime minister Ibrahim Jafari. Installed in 2006 with US backing, Maliki’s star rose within American circles in 2007 when he permitted US forces to pursue the Shia militia of Moqtada al-Sadr in Baghdad and later ordered his own to attack the militia in Basra.

But Washington’s faith concealed a growing vindictiveness toward his rivals. US officials nervously watched him arrest Sunni ex-insurgents who had agreed to fight al-Qaida. In 2008 he outmaneuvered US diplomats seeking a long-term presence in Iraq, a precursor to the lack of Iraqi support in 2011 for a residual force.

Once US forces left, Maliki accelerated his consolidation of power, installing loyalists in key military and security positions. He ordered the arrest of the top Sunni in the government. As sectarian violence returned to Baghdad, Maliki proved unable to stop it, even as Iraqis came to see him as a miniature Saddam Hussein.

His alienation from Washington was on stark display last fall when he visited Obama with an urgent request for weaponry, including a long-delayed sale of F-16s. Maliki returned to Baghdad with little more than a pledge of Hellfire missiles and Apache attack helicopters. Isis was at his doorstep.

Maliki’s resignation paves the way for closer US military assistance to stop Isis, which occupies three cities, much of Iraq’s rural heart, and continues to menace Baghdad. Isis also controls most of the border between Iraq and Syria, has emptied the Ninevah plains of minorities that have co-existed for several thousand years and advanced towards the Kurdish capital, Irbil.

Iraq’s new leader has pledged to work on building bridges between the Shia-led Government, the Sunnis and the Kurds. Central government control has whittled away as Isis has seized ground and public confidence in the political class has tanked.

With al-Abadi facing no further legal hurdles, he now has 26 days to form a government. Iraq’s constitution gives a nominated prime minister 30 days to do so, however the past four days had been consumed by Maliki refusing to leave.

US officials have indicated that an inclusive central government would make it easier for them to provide the same sort of military support they had to the Kurds in recent weeks. Airstrikes have slowed the momentum of Isis near Irbil and in the country’s northwest. However Barack Obama has ignored persistent pleas from Baghdad for similar help, insisting that political unity first be established.