Nuri al-Maliki has dropped his bid to remain Iraq's prime minister in a joint televised appearance with his designated successor.
"I announce before you today... to facilitate the progress of the political process and the formation of the new government, to withdraw my candidacy in favour of the brother Doctor Haidar al-Abadi," Mr Maliki said.
His replacement, Haider al-Abadi, has already been asked by Iraq's president to form a new government.
Tehran and Washington, the two main foreign power brokers in Iraq, came out in support of Mr Abadi.
Mr Maliki was dealt another major blow when the office of Iraq's top Shiite cleric released a letter in which he called for him to go.
Mr Maliki went from relatively unknown exile to become a powerful premier who has been widely criticised for authoritarian tendencies.
His tenure will end with Iraq facing a major crisis to which his policies have contributed.
Jihadist-led militants are in control of major areas of five Iraqi provinces, after launching an offensive in June that swept aside security forces, of which he is the commander-in-chief.
The UN's top envoy in Iraq praised Mr Maliki's decision to step down as prime minister, calling it a "historic milestone".
"The decision of Mr Maliki to allow the formation of a new government to proceed without further delay demonstrates statesmanship and a commitment to the democratic process and the constitution," Nickolay Mladenov said in a statement.
Meanwhile, US President Barack Obama said today that US air strikes had broken the siege of an Iraqi mountain sheltering civilian refugees and that troops conducting reconnaissance there would be withdrawn.
However, he added that US air strikes would continue against extremists from the Islamic State if they threaten US personnel and facilities in the region, including the Kurdish regional capital Arbil.
"The bottom line is -- the situation on the mountain has greatly improved and Americans should be very proud of our efforts because the skill and professionalism of our military and the generosity of our people we broke the ISIL siege of Mount Sinjar," Mr Obama said in a statement.
"We helped save many innocent lives. Because of these efforts, we do not expect there to be an additional operation to evacuate people off the mountain and it's unlikely we're going to need to continue humanitarian air drops on the mountain," Mr Obama said.
Mr Obama, a longtime skeptic of the use of US force in Iraq, last week authorised air strikes as he warned that thousands of members of the Yazidi community risked "genocide" as they fled to the mountain under pursuit from Islamic State extremists.
Mr Obama said that the US would still carry out air strikes along with stepping up military assistance to Iraqi government and Kurdish forces battling the IS fighters.