President Barham Salih has nominated head of intelligence Mustafa al-Kadhimi as Iraq's new prime minister-designate, the politically fragmented nation's third choice this year.
The nomination on Thursday came moments after predecessor Adnan al-Zurfi ended his bid to form a government. The upheaval threatened a leadership vacuum amid a severe economic crisis and the coronavirus pandemic.
"With my mandate to lead the Iraqi government, I pledge to my honourable people to work to form a government that puts the aspirations and demands of Iraqis as the top priority," al-Kadhimi tweeted shortly after his appointment was announced.
A ceremony was attended by the country's top political figures, indicating widespread support for al-Kadhimi, 53, that neither of the previous prime minister-designates had enjoyed.
That backing was the result of a flurry of political meetings over the past week aimed at a reaching consensus on al-Kadhimi, the head of Iraq's National Intelligence Service.
Among them were gatherings attended by Iranian General Esmail Qaani, who has headed Iran's elite Quds Force foreign operations unit after the US assassinated his predecessor, Qassem Soleimani, in an air strike in Baghdad in January.
Tehran holds vast political and military influence in Iraq, and its approval is seen as necessary for any prime ministerial candidate.
Pro-Iran factions staunchly opposed the nomination of al-Zurfi to the premiership, which ultimately forced the politician to withdraw his candidacy.
In a statement on his Facebook page, al-Zurfi said: "The failure to form a new government was the cause of domestic and foreign issues. But that will not prevent me from continuing to serve the people through my current parliamentary position.
"I will continue to work and prepare for early elections in order to complete our national project."
Before al-Zurfi, former minister Mohammad Allawi was also unable to pull together a cabinet.
In the interim, Iraq's caretaker prime minister Adel Abdul Mahdi - who resigned in December following months of anti-government protests - continued to lead the cabinet.
Al-Kadhimi, meanwhile, has long had close links with the United States, but political sources said he has also improved ties with Iran in recent months.
He now has 30 days to submit his cabinet lineup to the 329-member parliament for a vote of confidence.
Al-Kadhimi ascended to the role at a challenging time for Iraq, now facing a budget crisis brought on by the collapse of world oil prices and the spread of coronavirus.
Ordinary Iraqis have expressed anger at the failure of authorities to tackle the twin crises.
"If they keep going with their conflicts - 'We want this, we want that' - there will never be a government. because all parties want to fill the post with one of their own," said Baghdad resident Iman Khodr.
Al Jazeera's Simona Foltyn, reporting from Baghdad, said it remains to be seen if the new prime minister-designate will be able to get a government approved in 30 days.
"Although he seems to have secured widespread support at the moment, that could quickly change. Many in Iraq question whether he's really the one who can put an end to months of political uncertainty," said Foltyn.