An unusual method for producing antibiotics may help solve an urgent global problem: the rise in infections that resist treatment with commonly used drugs, and the lack of new antibiotics to replace ones that no longer work.

The method, which extracts drugs from bacteria that live in dirt, has yielded a powerful new antibiotic, researchers reported in the journal Nature on Wednesday. The new drug, teixobactin, was tested in mice and easily cured severe infections, with no side effects.

Better still, the researchers said, the drug works in a way that makes it very unlikely that bacteria will become resistant to it. And the method developed to produce the drug has the potential to unlock a trove of natural compounds to fight infections and cancer — molecules that were previously beyond scientists’ reach because the microbes that produce them could not be grown in the laboratory.

Teixobactin has not yet been tested in humans, so its safety and effectiveness are not known. Studies in people will not begin for about two years, according to Kim Lewis, the senior author of the article and director of the Antimicrobial Discovery Center at Northeastern University in Boston. Those studies will take several years, so even if the drug passes all the required tests, it still will not be available for five or six years, he said during a telephone news conference on Tuesday. If it is approved, he said, it will probably have to be injected, not taken by mouth.