SACRAMENTO — California became the first state in the nation Saturday to ban the routine use of bacteria-fighting drugs in livestock when Gov. Jerry Brown signed a bill to clamp down on the practice blamed for breeding “superbugs” that spawn deadly infections in humans.

The Centers for Disease Control and Prevention estimates that more than 2 million people are sickened and at least 23,000 die each year from antibiotic-resistant infections, and scientists say widespread use of the drugs in livestock is a leading cause of the problem.

“The science is clear that the overuse of antibiotics in livestock has contributed to the spread of antibiotic resistance and the undermining of decades of life-saving advances in medicine,” Brown said in a signing statement.

Starting in 2018 when the new law takes effect, farmers and ranchers will be prohibited from regularly giving low doses of antibiotics to healthy farm animals to prevent illness or to speed up growth before the animals are slaughtered — practices that are common now.

Giving low doses of antibiotics to large numbers of animals for a long period of time causes bacteria to develop immunity to the treatment. Some bacteria are naturally more able to withstand the drugs than others, and over time, they continue to breed resistant strains as the weaker ones die off.

Large corporations such as McDonald’s have already announced plans to phase-out their use of antibiotics in meat and poultry production. Brown noted in his signing message such voluntary efforts are an example for the industry to follow. But California is the third-largest producer of livestock in the U.S., behind Iowa and Texas, so the law is expected to send a signal to the market and become a model for other states.

“By 2050, more people will die from antibiotic-resistant bacteria than from cancer,” said Sen. Jerry Hill, D-San Mateo, the author of Senate Bill 27, quoting a research study. “I heard that statistic, realized nothing was being done and knew I needed to take action to stop this from becoming our reality.”

Farmers first gave antibiotics to chickens in the 1950s when they realized small doses of tetracycline — a drug used to treat chlamydia and some Staphylococcus infections in humans — could make hens grow bigger, faster.

By the mid-1970s, the Food and Drug Administration had grown concerned about antibiotic resistance and planned to ban over-the-counter sales of the drugs for use in livestock. But heavy lobbying by farmers and drug makers forced the agency to delay and ultimately drop those plans.

“The federal government has been so dysfunctional and so unable to address important public health issues that problems like these must now be handled by the states,” said Michael Blackwell, chief veterinary officer for the Humane Society of the United States. “This legislation is a critically important first step for the nation.”

Once the legislation takes effect, farmers and ranchers may only obtain the drugs through a licensed veterinarian to treat an infection, control the spread of a disease or administer to an animal after surgery. Senate Bill 27 also requires the state to coordinate with the FDA to track sales of antibiotics to ensure compliance with the law.

Assembly Appropriations Committee analysts estimate it will cost the state $5.5 million over the next two years to prepare to implement the bill and another $4.3 million annually thereafter to continue training, inspections and tracking. It’s unclear how much the bill will cost an average farmer or rancher.

Last year, the California Farm Bureau Federation and other trade groups for farmers and ranchers opposed a measure that would have prohibited sales of livestock given routine antibiotics, and the bill died in the Assembly Committee on Agriculture.

Hill had better luck this year because he struck the right balance between halting the overuse of antibiotics and making sure farmers could still get the drugs to care for sick animals, said Noelle Cremers, director of natural resources and commodities for the farm bureau, which didn’t take a position on the bill.

“Humans need antibiotics for life-saving purposes, and so do livestock,” Cremers said. “We wanted to make sure that California’s policy on this issue would address the issue of resistance without cutting off access.”

The Natural Resources Defense Council and other environmental groups opposed an earlier version of the bill that they felt didn’t have strong enough protections to prevent use of the drugs for nontherapeutic purposes. But once Hill agreed to the amendments they sought, the groups became strident supporters.

Avinash Kar, senior attorney with the Natural Resources Defense Council’s Health Program, called the bill “a game changer.”

“By reining in the misuse of these miracle drugs,” Kar said, “it helps ensure that life-saving antibiotics will be effective when we need them most.”

Contact Jessica Calefati at 916-441-2101. Follow her at Twitter.com/Calefati.