The move, which followed weeks of international and domestic pressure, defuses a political deadlock that has plunged Iraq into uncertainty at a time of the nation's greatest turmoil since the 2011 withdrawal of US troops.
Al-Maliki announced he was giving up his post on national television late yesterday, standing alongside senior members of his Shiite Islamic Dawa Party, including his rival and premier-designate Haider al-Abadi.
Al-Abadi, a veteran Shiite lawmaker, now faces the immense challenge of trying to unite Iraqi politicians as he tries to cobble together a Cabinet over the next 30 days. The country's major political factions deeply distrust each other and the army seems unable to regain territory in the north and west taken by militants from the Islamic State group.
Al-Maliki had been struggling for weeks to stay on 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.
More From This Section
The crisis in Baghdad escalated when al-Maliki's Shiite alliance backed al-Abadi to replace him, and the incumbent threatened legal action, saying the attempt to push him out was a violation of the constitution.
But in a meeting of his party earlier yesterday, al-Maliki agreed to endorse al-Abadi and drop the lawsuit, two senior lawmakers from his State of Law parliamentary bloc, Hussein al-Maliki and Khalaf Abdul-Samad, told The Associated Press.
US Secretary of State John Kerry said the move "sets the stage for a historic and peaceful transition of power in Iraq."
The challenges for al-Abadi are looming.
"The problems and crises left by al-Maliki are huge," said Aziz Jaber, a political sciences professor at Baghdad's Mustansiriyah University. "The first thing al-Abadi must do is foster real national reconciliation and defuse anger among many Iraqis affected by al-Maliki's unwise policies."