Unrest broke out in Chengdu, China, over bad food served to children at a private school in the city. (Qilai Shen/Bloomberg News)

BEIJING — Revelations this week that a highly rated private school in southwestern China fed pupils moldy food sent hundreds of angry parents into the streets, where they blocked traffic and clashed with police before being dispersed by pepper spray.

Police in Chengdu, a southwestern Chinese metropolis known for its panda preserve and spicy Sichuanese cuisine, said in a statement Thursday that they detained 12 people and used pepper spray — “the minimum volume in accordance with the law” — to clear the streets after scuffles broke out.

In a country that responds forcefully to unrest, the police statement was almost apologetic by Chinese standards, highlighting how citizens fed up by perennial food and school safety scandals have been able to put the government on the defensive and challenge its authority.

Online footage showed fuming parents chanting into megaphones on the street. Mothers scuffled with policemen who tried to break up the protest. In one video, a man smashed the school principal’s microphone when he tried to give a speech to lower tensions.

If the unrest was remarkable, so was the backstory of how the scandal came to light.

A parent went undercover to work in the school kitchen for one month after students started complaining of stomachaches, according to domestic media reports. The parent took pictures of moldy ribs and bits of octopus and pig parts and shared them online, where they went viral.

Pictures from the Weibo microblogging website showed parents hanging a red banner accusing the First City Group Number 7 School of abusing children. The private elementary school, located in the west of the Sichuan provincial capital, is affiliated with one of the city’s best schools and was founded by First City Group, an overseas Chinese investment group with multiple property developments.

“I just want to cry in silence. I sent my child to school at 5 ½ years old, gave all the trust to the school, and this is what has happened,” a Chinese financial news site quoted a mother as saying.

The local government said in a statement Wednesday that the school has terminated its deal with the food supplier and launched investigations into related parties. It noted the police statement that they had used “minimum” pepper spray to maintain order, adding that they first tried to persuade parents to leave without success.

“Some of them stopped passing cars and cut off traffic, which severely disturbed the normal social order,” the government statement said. “Police on site started quickly evacuating and persuading them to leave, but some tried to obstruct the police enforcement by hitting and cursing police.”

Twelve parents were released Wednesday afternoon after “realizing the social harmfulness of their own behavior,” the statement said.