NAJAF, Iraq — Prime Minister Adel Abdul Mahdi of Iraq formally submitted his resignation to Parliament on Saturday and asked lawmakers in a televised national address to quickly agree on a successor.
But Mr. Mahdi’s resignation may not spell the end of the turmoil that has racked the nation over the past two months. Parliament, which met on Sunday and voted to accept his resignation, has yet to agree on an alternative.
“The resignation of the government is a method of peaceful handover of power in democratic systems,” Mr. Mahdi said in his brief speech, adding that the government had tried to meet the demands of the country’s widening protest movement.
Protests driven by anger over political corruption and Iran’s influence over Iraqi politics — coupled with the government’s violent response — had put Mr. Mahdi under intense pressure to step down. At least 400 people have been killed in the unrest, according to the United Nations and hospital sources.
The formation of a new government could go quickly, but it will more likely take weeks, if not months. That realization quickly dissolved protesters’ initial jubilation over Mr. Mahdi’s announcement on Friday that he would step down.
Mr. Mahdi and his ministers would still serve in a caretaker government until President Barham Salih requests that the largest bloc in Parliament name a new prime minister and that person’s ministers are then approved by a majority. History shows that agreeing on a prime minister can be a long, arduous process of balancing competing political factions.
It became so protracted in 2018 that Iranian officials helped set up the current government, brokering an agreement that brought in Mr. Mahdi and Mr. Salih as well as the Parliament speaker, Mohammed al-Halbousi.
One significant question is whether Iran will play the same role this time around. Since Iraqis are now openly expressing resentment toward Tehran, its direct involvement might be a liability.
Across the Shiite-dominated south of Iraq, as well as in the capital Baghdad, the chant “Out, Out Iran, Baghdad Remains Free” is part of the daily protests. If one thing is clear, the fact that Iraq is majority Shiite and so is Iran does not mean that Iraqi and Iranian Shiites have shared views.
In Najaf, a city that hosts several million Iranian pilgrims annually at its shrines and where Iranian clerical students train in its religious universities, the resentment of Tehran’s insertion into Iraqi affairs is running so high that protesters burned the Iranian Consulate there on Wednesday night.
Three days later, the walls of one office in the complex were still faintly warm from the flames. A wall of file cabinets had been burned to a shell and the papers that had been inside were little more than a pile of ashes. The door had been ripped off a safe.
In the courtyard, the smell of burned wires and rubber drifted in the air as half-blackened documents blew in the autumn breeze and a single, charred sandal lay on its side. A carton of lemons, most of them covered with ash, rolled about on the tiles.
The complex’s metal-frame buildings were so warped by the heat and looked so ruined that while they had not burned to the ground, their reconstruction would be a major undertaking.
No one was inside when the complex was set afire because the only two Iranian employees left through the back door when security guards realized they would not be able to hold off the protesters, said Abu Rusol, one of the guards.
Just a few hundred feet away, the shrine of Mohammed Baqr al-Hakim, a cleric assassinated in 2003, was a scene of tension on Saturday, with protesters facing off against Shiite militiamen protecting the site.
Mr. al-Hakim, although an Iraqi, spent years in exile in Iran and was part of the opposition to Saddam Hussein. Now his links to Iran have made his shrine a target of demonstrators.
Skirmishes continued at the shrine late Saturday afternoon. Protesters, who were largely unarmed, were coming into emergency treatment tents with gunshot wounds, said Muahin Yasseen, a fifth-year medical school student who had volunteered to help.
The United States — though it has sought political reforms in Iraq, especially on corruption — had wanted Mr. Mahdi to remain in office, worried that his departure could lead to even more extensive bloodshed.
Mr. Mahdi, however, has been unable to control the violence and the pressure on him to step down has built for some time. He resisted until the latest spate of killings and a looming threat of a no-confidence vote in Parliament.
On Friday, Grand Ayatollah Ali al-Sistani, the senior Shiite cleric in Iraq, urged Parliament to stop procrastinating or “the country will pay a high price, and everyone will regret it.”
It was in the hours after Mr. Sistani’s message that Mr. Mahdi announced his intention to resign.