BAGHDAD — The antigovernment protests that have shaken Iraq for months took a brutal turn on Thursday when protesters lynched a 16-year-old boy who had fired a pistol in the air to try to shoo them away from his family’s home.

The protesters stabbed him 17 times, hung him by his ankles from a traffic light pole and cut his throat. In videos of the scene, people in police uniforms can be seen in the midst of the mob, seemingly allowing the attack to take place.

The rare outburst of violence by the protesters underscored the increasing tension on the streets after the killing of more than 400 protesters by government forces and a recent spate of attacks by other groups, while the absence of a response by either the police or bystanders, many of whom recorded the killing on their cellphones, raised questions about the complicity of Iraqi society.

The Iraqi High Commission for Human Rights condemned the police behavior as well as the lack of any effort by citizens to stop the violence. “The presence of hundreds if not thousands of citizens who stood still, filming and watching is a dangerous development that confirms the society’s acceptance of violence,” said Ali al-Bayati, a commission member.