The protests, which began last Tuesday, seemed to come out of nowhere, but were apparently set off by a disturbing political event: the removal in September of a highly respected general, Abdul-Wahab Al-Saadi, from the leadership of the counterterrorism command.

General Al-Saadi, who was widely believed to have done a good job in fighting the Islamic State, especially on the difficult battlefields of Mosul and Falluja, was peremptorily removed from his job and assigned to the Ministry of Defense.

General Al-Saadi’s profile — he is a Shiite but not aligned with any party — made him something of an Everyman soldier-hero. His dismissal was explained on the street as linked to his lack of corruption, in contrast to other senior figures, and his refusal to kowtow to the Popular Mobilization Forces, military entities within the Iraqi security forces, some of which have links to Iran.

Whether people knew General Al-Saadi was less important than what he stood for, said Abbas Kadhim, the director of the Iraq Initiative and a senior fellow at the Atlantic Council who was visiting southern Iraq when the demonstrations started.

“This was just a spark that unleashed all built-up grievances,” he said.

“Many of the grievances are not about Adel Abdul Mahdi’s government,” he added, referring to Iraq’s prime minister. “But when you are the prime minister, you have to pay for your mistakes and those of previous leaders.”

At first, the demonstrations were small, but as the police and security forces responded with violence, they grew and quickly spread. The government made little effort to curb the security forces’ violence, and by Friday the Iraqi Federal Police had warned in a statement that snipers who were not part of the security forces were shooting at both the protesters and the police.