MADRID — At least 17 children in Spain developed a form of “werewolf syndrome” after they were given medication intended to treat heartburn that was actually used to stop hair loss.

The children who took the mislabeled medicine, some of them babies, began growing hair all over their bodies, a rare condition known as hypertrichosis, Spain’s health minister said on Wednesday.

The minister, María Luisa Carcedo, said that a Spanish laboratory, Farmaquimica Sur, had erroneously distributed to pharmacists minoxidil, a drug that helps fight baldness, that was labeled omeprazole, a drug that treats acid reflux.

The pharmaceutical company, which is based in the southern city of Málaga, got its supplies of omeprazole from India, according to health inspectors quoted by local news outlets. But there is no evidence that the problem originated there or that it went beyond the mislabeling that occurred in Spain.