Iraq's lawmakers have re-elected Jalal Talabani as Iraq's president, despite a walk-out by a major bloc of MPs after a dispute over whether a day-old power-sharing deal was being honoured.
Mr Talabani immediately nominated Nuri al-Maliki to stay on as the country's prime minister.
Iraq's deeply divided political factions reached agreement on Wednesday on a power-sharing deal that divides the three top government posts among Shi'ite, Kurdish and Sunni factions.
The deal was a major breakthrough in an eight-month political impasse that followed an inconclusive March election.
Mr Talabani secured 195 votes in support of his candidacy, while 18 votes were declared invalid, newly elected parliament speaker Osama al-Nujaifi said.
The president failed to reach the required two-thirds threshold on the first attempt when votes were cast, but Iraq's constitution stipulates that in such a case, a second vote requires only a simple majority to elect a president.
After Mr Nujaifi's election, the Iraqiya grouping, led by ex-premier Iyad Allawi, had claimed provisions of the power-sharing deal were being violated.
Specifically, Iraqiya had called for three of their lawmakers, barred for their alleged ties to Saddam Hussein's Baath party, to be reinstated before voting for a president.
When their demands were not met, some 60 MPs left the chamber.
After some confusion, the remaining lawmakers began voting on whether or not to re-elect Mr Talabani as president.
The newly elected speaker, Osama al-Nujaifi, is a senior leader of the Sunni-backed, cross-sectarian Iraqiya alliance.