NEW DELHI — The children complained that the free lunch at their state school — rice, beans, potato curry and soy balls — tasted odd. The cook gave it a taste, too. Within half an hour they all began to suffer severe stomach pains followed by vomiting and diarrhea, and within hours at least 22 of the children were dead and dozens of others remained hospitalized, said officials in the northeastern state of Bihar.

By nightfall on Wednesday, as angry protests broke out, officials said they believed they had found the cause: cooking oil stored in a container formerly used for insecticides.

School lunch programs became universal in India after a 2001 order by the country’s Supreme Court, and free meals are now served to 120 million children — by far the largest such program in the world. It has been credited with improving school attendance, sometimes substantially. With some surveys suggesting that nearly half of Indian children suffer some form of malnutrition, it also serves a vital health purpose.

But like so many government programs in India, it is plagued by corruption and mismanagement, and cases of tainted food are fairly routine.