Scary antibiotic-resistant infections aren't just lurking in the hospital anymore. They're in gyms, at the beach, and increasingly, on the farm.

One strain of methicillin-resistant Staphylococcus aureus (MRSA) known as CC398 has been rapidly spreading through poultry and pig farms, infecting people who work with the animals around the world (up to 26.5 percent of farm workers sampled in the Neatherlands), and popping up in nearly half of all meat sampled in the U.S.

A new genetic study shows that this form of staph started out in humans as a more standard, susceptible strain. But only once it jumped to livestock did it become resistant to common antibiotics methicillin and tetracycline, according to the research, published online Tuesday in mBio, the journal of the American Society for Microbiology.

For the study, researchers sequenced the genomes of 89 samples of the strain from humans and livestock, which were collected from 19 countries on four continents. "Retracing the evolutionary history of MRSA CC398 is like watching the birth of a superbug—it's simultaneously fascinating and disconcerting," Lance Price, director of Translational Genomics Research Institute (TGen) Center for Food Microbiology and Environmental Health in Phoenix, and study co-author, said in a prepared statement.

From the genetic data, the researchers could ascertain what this strain originally looked like—and how it spread. "Most of the ancestral human strains were sensitive to antibiotics, whereas the livestock strains had acquired resistance on several independent occasions," Ross Fitzgerald, of the University of Edinburgh, who reviewed the paper, said in a prepared statement.

A 2010 study sequenced strains of hospital-acquired MRSA from around the world and found that those strains, too, had acquired resistance multiple times in different geographic locations.

The detailed new study helps to clarify how this new breed of drug-resistant staph, known as livestock-acquired MRSA, has become so prevalent among livestock so quickly—after only having been spotted spreading back to humans about a decade ago. "We can't blame nature or the germs," Paul Keim, director of TGen's Pathogen Genimics Division and co-author of the study, said in a prepared statement. "It is our inappropriate use of antibiotics that is now coming back to haunt us."

"The most powerful force in evolution is 'selection,'" Keim said. "And, in this case, humans have supplied a strong force through excessive use of antibiotic drugs in farm animal production."

In the U.S. and many other countries, farmers don't just use antibiotics to treat sick animals. Many producers feed it to their livestock in low levels as a preventive measure to keep animals that are in confined feeding operations, such as feed lots, from getting sick while being in such close proximity to one another. These low levels, however, are thought to be an excellent evolutionary pressure to select for strains that are resistant to these drugs—drugs that we also rely on to cure bacterial infections in people. [Read more about the use of antibiotics in farming in "Our Sick Farms, Our Infected Food" and "Our Big Pig Problem" in Scientific American.]

"Staph thrives in crowded and unsanitary conditions," Price said. "Add antibiotics to that environment, and you're going to create a public health problem." A new form of MRSA was reported in humans and dairy cows in 2011.

Despite the increased spread of MRSA CC398 from animals to people in Europe, genetic changes in the strain seem to inhibit its spread among humans. The next step, say researchers, will be to look more deeply into the bacteria's genome to see what elements make it such an agile jumper among species—and what mutations could potentially make it even more so.