BAGHDAD — A dozen senior military and police commanders in Iraq will be removed from their posts and will face prosecution on accusations of allowing their troops to shoot demonstrators at mass protests this month without an order from the prime minister’s office, the government announced on Tuesday.

During five days of protests in the first week of October, at least 149 civilians were killed and 4,207 others wounded, an official report found. The report also said that eight members of the security forces had been killed and 1,287 others wounded. The overwhelming majority of the protesters were unarmed.

The punitive action taken by Adel Abdul Mahdi, Iraq’s prime minister, was the sharpest rebuke of military excess at any time in recent years, and its language was strikingly clear and strong. It nevertheless drew broad criticism from Iraqis across the political spectrum, mixed in with some praise.

The sharpest words came from those disappointed that the government had failed both to take responsibility for its part in the bloodshed and to hold to account the popular mobilization units, some backed by Iran, known as Hasht al-Shabi. Security units linked to the groups were believed to be responsible for some of the most deadly excesses.