A medical official confirmed Thursday that pesticide had contaminated the free school lunch that killed 23 children in the eastern Indian state of Bihar this week, a tragedy that triggered public outrage and exposed flaws in one of India’s signature social programs.

The children, most of them between the ages of 5 and 12, fell sick Tuesday at their school in the village of Gandamal almost immediately after eating the midday meal of rice, lentils, potatoes and soy. Amarkant Jha Amar, the superintendent of Patna Medical College and Hospital in Bihar’s capital, said it appeared from postmortem reports that pesticide either was used instead of cooking oil or got mixed with the oil used to prepare the lunch.

“This is not an ordinary food-poisoning case, because the instant deaths means there was a large amount of poisonous substance,” he said.

The free midday-meal program, which covers more than 120 million schoolchildren, was launched nationwide more than a decade ago with the goals of raising school enrollment and improving childhood nutrition. An independent survey in 2011 found that four out of 10 Indian children are severely malnourished.

More than 96 percent of children between the ages of 6 and 14 in rural India were enrolled last year, up from 81 percent in 2001, according to official data. The government asserts that the midday meal scheme contributed significantly to that improvement.

Despite the program’s successes, there have been many cases of tardy implementation and food poisoning. Tuesday’s horrific death toll underscored how the program has at times failed to comply with standards.

“The first violation: How did the cooking oil and pesticide mix? Second, when oil was poured into the pan, there was a foul smell and fumes arose, but the principal did not pay attention even after the cook complained,” Amar said. “The rules say that the cook or principal must taste the food first before serving it to the children. That rule was also violated.”

Amar said 25 children and a cook were still in the hospital but out of danger. He added that officials are awaiting the final laboratory analysis of the ingredients found at the school.

Many government-run rural schools in India, especially in the impoverished state of Bihar, lack hygiene, infrastructure, electricity and running water. Meals are often cooked in dank, windowless rooms hung with cobwebs and crawling with insects.

The national government’s guidelines for the program include suggestions such as storing food grains away from moisture and in airtight containers, washing leafy vegetables before cutting, keeping kitchens clean and well-ventilated, and hiring cooks who clip their nails and wash their hands.

But even those basic standards are routinely flouted, observers say.

“The village schools are in such a sorry state, we frequently hear of lizards falling into cooked food, there is no cleanliness in the kitchen, and the budget is siphoned off by corrupt officials,” said Ajit Kumar, an activist in Patna who requested information about the program from officials two months ago. “The school ends up buying the worst quality of food grain and rotten vegetables.”

According to Indian media reports, many parents in Bihar sent their children to school with packed lunches Thursday and forbade them to eat the school food. Others protested on the streets, blocking the routes to neighborhood schools.

Two years ago, a similar poisoning incident prompted calls for precooked, packaged meals to be served in schools, but officials said that would be difficult to implement.

In New Delhi, Human Resources Development Minister Pallam Raju told reporters that his office was aware of some of the problems with Bihar’s lunch program.

“We had alerted the Bihar government quite a few months back about shortcomings in its food storage,” he said. “There were about 12 districts identified. An alert was sent. We had expected that the Bihar government would have acted on the recommendations.”

The Bihar government denied that assertion. “No such alert was issued to us,” said the state’s principal secretary for education, Amarjeet Sinha, according to the Press Trust of India. He added that his government had held a cleanliness training workshop in April for school principals and cooks.

On Thursday, officials suggested that foul play had not been ruled out. Amar, the hospital superintendent in Patna, said the investigation underway will soon reveal whether the mass poisoning in Gandamal was “an accident or something else.”