BAGHDAD (Reuters) - Iraq’s parliament voted on Sunday to accept the resignation of Prime Minister Adel Abdul Mahdi after weeks of violent anti-government protests that have rocked the country.

FILE PHOTO: Iraqi Prime Minister Adel Abdul Mahdi speaks during a symbolic funeral ceremony of Major General Ali al-Lami, who commands the Iraqi Federal Police's Fourth Division, who was killed in Salahuddin, in Baghdad, Iraq October 23, 2019. REUTERS/Khalid al-Mousily /File Photo

Abdul Mahdi’s decision to quit on Friday came after a call by Iraq’s top Shi’ite Muslim cleric Grand Ayatollah Ali al-Sistani for parliament to consider withdrawing its support for Abdul Mahdi’s government to stem the violence.

“The Iraqi parliament will ask the president of state to nominate a new prime minister,” a statement from parliament’s media office said.

Lawmakers said Abdul Mahdi’s government, including the prime minister himself, would stay on in a caretaker capacity until a new government is chosen.

Under the constitution, President Barham Salih is expected to ask the largest bloc in parliament to nominate a new prime minister to form a government, a move expected to trigger weeks of political wrangling.

Iraqi forces have killed nearly 400 mostly young, unarmed demonstrators since mass anti-government protests broke out on Oct. 1. More than a dozen members of the security forces have also died in clashes.

Abdul Mahdi’s resignation, though welcomed by protesters, is not expected to end the demonstrations, which have called for an overhaul of a political system accused of being corrupt and keeping most of the population in poverty.

Protesters on Sunday torched the Iranian consulate in the holy Shi’ite city of Najaf for the second time in a week, police and civil defense sources said.

Demonstrators entered the consulate in Najaf on Wednesday and set fire to the entire building, drawing a deadly response from security forces and escalating the unrest that has led to Abdul Mahdi’s resignation.

Demonstrations are continuing in Baghdad and other southern regions. Security forces killed one protester and wounded nine others near a bridge in the capital on Sunday, police and a medical source said.

In Nassiriya, two protesters died on Sunday from wounds sustained in previous clashes with security forces in the southern city, police and medical sources said.

The unrest poses the biggest challenge for Iraq since Islamic State insurgents seized swathes of Iraqi and Syrian territory in 2014.

It pits mostly young, disaffected Shi’ite protesters against a Shi’ite-dominated government backed by Iran and accused of squandering Iraq’s oil wealth while infrastructure and living standards deteriorate.