Iraqi President Barham Salih appointed Mohammed Tawfiq Allawi as prime minister on Saturday, state television reported, after squabbling parties failed to name a candidate in the two months since Adel Abdul-Mahdi was ousted by mass protests.
Allawi, who will run Iraq until early elections can be held, must form a new government within a month and will likely get stuck between powerful parties vying for cabinet posts, prolonging the political deadlock.
Allawi said he would resign if political blocs attempted to impose candidates for cabinet jobs, and called on protesters to continue demonstrating until their demands are met.
"I'm an employee (at your service) carrying your trust, so do not go back until you get what you want, whether from me or someone else," he said in a video message posted to his Twitter feed and broadcast by state television.
"If the political blocs try to impose their candidates (for ministers) on me, then I will resign."
Abdul-Mahdi quit in November during mass anti-government unrest in which hundreds of thousands of Iraqis took to the streets to demand the removal of Iraq's political elite.
Nearly 500 protesters have been killed since October in a deadly crackdown by security forces.
Soon after the president's announcement, protesters gathered in Baghdad and southern cities expressed opposition to Allawi's appointment in videos posted on social media.
"Allawi is rejected," they chanted in one video that was filmed at Baghdad's Tahrir Square, the centre of the uprising in the Iraqi capital.
For the demonstrators, Allawi, the former communications minister under ex-premier Nuri al-Maliki — who presided over the fall of multiple Iraqi cities to Daesh in 2014 and is accused of pro-Shi'ite sectarian policies -- is part of the ruling elite and therefore unacceptable.
Hours before Allawi's appointment, supporters of populist cleric Moqtada Al-Sadr attacked protesters in Tahrir square.
Sadr called on Friday for a mass protest in Baghdad and for sit-ins near the fortified Green Zone to protest the delayed formation of a government, without specifying when the gatherings should take place.
Sadr later supported Allawi's appointment, saying he had been "chosen by the people" and that this was a "good step" for Iraq. Sadr, a political opportunist, has both backed protests and sided with the Iran-backed political groups they reject.