WASHINGTON — Federal drug regulators announced on Wednesday that farmers and ranchers must restrict their use of a critical class of antibiotics in cattle, pigs, chickens and turkeys because such practices may have contributed to the growing threat in people of bacterial infections that are resistant to treatment.

The medicines are known as cephalosporins and include brands like Cefzil and Keflex. They are among the most common antibiotics prescribed to treat pneumonia, strep throat, and skin and urinary tract infections. Surgeons also often use them before surgery, and they are particularly popular among pediatricians.

The drugs’ use in agriculture has, according to many microbiologists, led to the development of bacteria that are resistant to their effects, a development that many doctors say has cost thousands of lives.

Antibiotics were the wonder drugs of the 20th century, and their initial uses in both humans and animals were indiscriminate. Farmers became so enamored of the miraculous effects of penicillin and tetracycline on the robustness of cattle, chickens and pigs that the drugs were added in bulk to feed and water, with no need for prescriptions or any sign of sickness in the animals.