Nouri al-Maliki has given up his fight to remain Prime Minister of Iraq and now supports his replacement, Haider al-Abadi.
It ends a political deadlock that's thwarted government attempts to deal with insurgents.
Mr Maliki faced huge pressure to step aside for a less polarising figure who can counter Islamic State militants who have taken control of large parts of the country.
His replacement, Haider al-Abadi, had already been asked by Iraq's president to form a new government.
Mr Maliki was under intense political pressure to make way for Mr Abadi, who is a deputy speaker of parliament.
An offensive led by Islamic State rebels in the north has triggered a security and humanitarian crisis.
Mr al-Maliki dropped his bid for a third term as prime minister of Iraq and pledged support for his replacement, the moderate Shi'ite Haider al-Abadi.
Appearing on state television, flanked by Abadi and other Shi'ite politicians, Mr Maliki spoke of the grave "terrorist" threat from Islamic State Sunni militants before giving up on his fight to stay on.
"I announce before you today, to ease the movement of the political process and the formation of the new government, the withdrawal of my candidacy in favour of brother Dr Haider al-Abadi," said Maliki.
Mr Abadi is seen as a far less polarising figure with a chance of uniting Iraqis against Sunni insurgents who've captured large parts of the country in the north and west - including Iraq's largest dam and five oil fields.
The announcement was likely to please the Sunni minority which dominated Iraq under Saddam Hussein's iron-fisted rule but was then sidelined by Mr Maliki, a relative unknown when he came to power in 2006 with strong United States backing, Reuters reports.
The US president, Barack Obama, has called on Mr Abadi to unite the country against fighters from the Islamic State group, which is sometimes known as ISIL.
"We are urging Iraqis to come together to turn the tide against ISIL above all by seizing the enormous opportunity of forming a new, inclusive government under the leadership of prime minister designate Abadi."
Mr Obama said Mr Abadi had told him he wanted to create a democratic government.