She was only 22 years old, but her attending doctor in Texas was running out of options. The sticky substance coating the patient's lungs was par for the course with cystic fibrosis (CF); mucus is a signature of this heritable, progressive and incurable disease. So, too, is infection. But this time, a particularly nasty and stubborn bug had taken hold. The persistent presence of bacteria was putting an additional burden on the young woman's already overtaxed respiratory system, and chronic infection degrades lung function. The best antibiotics Western medicine had to offer had failed.

The Scottish physician Alexander Fleming discovered the first modern antibiotic, penicillin, in 1928. In 1945, Fleming issued a warning: should we misuse or overuse antibiotics, bacteria can and will resist. Today, resistance has become a scourge of modern medicine. Not only did we deploy antibiotics to save lives, but for commercial gain - pumping them into industrial farm animals, from cows and pigs to chicken and fish. Under pressure from this assault, bacterial populations did what they'd done for aeons: evolve or die. Those strains that could survive antibiotics are now winning the evolutionary race, and we are progressively running out of cures.

One solution, according to the late Joshua Lederberg, a Nobel Prize-winning molecular biologist, is to 'drop the Manichean view of microbes: "We good; they evil".' In a 2000 essay in Science magazine, he argued that humans needed to work with nature rather than against it; we needed to take 'the germs'-eye view of infection'. Modern medicine tends to adopt a somewhat mechanistic approach: fix the flaw, repair the malfunction, extricate and eradicate the invading entity. But the human body and illness do not follow such linear paths; they are influenced by ecological and evolutionary processes, which new treatments might try to manage in a more holistic way.

In the case of the young woman, the bacteria that had colonised her respiratory system was called Pseudomonas aeruginosa. It's one of a dozen or more bugs commonly acquired in hospitals, but can be found almost anywhere, from a door knob to the kitchen sink. Those with CF are particularly susceptible; by some estimates nearly 60 per cent of adults with CF are infected with the potentially lethal bacteria. In a petri dish, P aeruginosa grows into a shimmering blue-green colony of cells; in an infected lung, the microbes build a fortress of sticky slime. Within these so-called biofilms, the community of bacteria work together, share food, provide protection for one another, and swap DNA. Like most of us, bacteria work 'better' together. They can also hide from a body's immune cells, and from antibiotics. When a biofilm forms, whether on the inner surface of the lungs, a catheter or a surgical patch, it's tricky to eradicate. To add insult to infection, like many other pathogens, P aeuroginosa is becoming increasingly antibiotic-resistant.

But the patient's father had read about an experimental approach called 'phage therapy' that involved infecting infections with a virus. He suggested it to the physician. In October 2017, she contacted Benjamin Chan, a young microbiologist at Yale University. Alongside his colleague, the ecologist and evolutionary biologist Paul Turner, he'd been pioneering ways to make the therapy more reliable. Did Chan and Turner, she wondered, have a phage that might save her patient?

Phage therapy is not so much a cutting-edge new treatment as a revival and updating of an old one. 'Phage' derives from the Ancient Greek phágos, for 'glutton', and phageîn, 'to eat'. In a biological context, it's short for 'bacteriophage': a category of viruses, each of which targets a specific species or strain of bacteria. You can find them anywhere and everywhere. Chan goes 'bioprospecting' for phages in sewage, ponds and drains - basically 'wherever the bacteria are,' he told me. 'It's pretty gross.'

Phages were discovered before modern antibiotics, more than a century ago, when physicians had few options for curing infectious diseases. At the time, the bacteria behind diseases such as anthrax, tuberculosis, syphilis and diphtheria had been revealed, but viruses remained something of an enigma. Here were disease-causing agents capable of passing through the finest bacteria-catching filters. What could be smaller than bacteria? The true nature of viruses would remain a mystery for decades: bits of DNA wrapped in protein, straddling the netherworld between living and inert, which commandeer the cell's reproductive machinery to make dozens or hundreds of copies of themselves.

By 1919, Félix d'Herelle, a French-Canadian microbiologist, had noticed that certain viruses had bacteria-busting powers. That summer at a hospital in Paris, three young brothers whose sister died from dysentery had come under the care of the paediatrician Victor Henri Hutinel. Having isolated a phage from the faeces of another dysentery patient, d'Herelle was ready to give the treatment a go. After taking a swig of the prepared phage solution (along with Hutinel and several interns) and showing no ill effect, the microbiologist was permitted to inject one sibling, and eventually the others. Within a day, their symptoms subsided. By the next decade, physicians around the globe were preparing phage 'cocktails', mixing multiple live viruses, to treat patients with typhoid, staph, strep and cholera.

But phages were soon eclipsed by other treatments. In 1910, the first synthetic antimicrobial, a molecule related to arsenic known as arsphenamine or Salvarsan, had been found to be an effective treatment for syphilis. Then came Fleming's discovery of penicillin, a naturally occurring chemical compound originally extracted from mold. It worked by attacking the bacterial cell wall, a structure made of sugars and amino acids that is common to most bacteria. Like a chicken-wire frame, the wall is what prevents bacteria from exploding under their own internal pressure. Make a chink in the wall, and - bam! The cell bursts like an overfilled balloon, leaving our human cells, which have a different structure, relatively unscathed. By the 1940s, doctors were liberally dispensing the 'miracle drug' of penicillin; in the following decades, other antibiotics such as carbapenems, polymyxins and macrolides were developed, each capitalising on some distinctive feature that divided bacterial cells from our own.

Throughout the first half of the 20th century, research into phage therapy continued. But it soon became obvious that antibiotics enjoyed several advantages. They could be meted out in much more precise and effective doses than phage viruses, which had to be grown within their bacterial host cells, and then collected and cleaned up. Antibiotics could also attack a number of different infections, but because each phage responded only to a specific bacterial strain, a doctor had to be sure that he (as most of them were back then) had the right phage for the relevant infection. Unscrupulous producers hawked products with little or no virus, or the wrong kind of phage. Sometimes the therapy worked brilliantly but other times it failed. A couple of negative reviews published in TheJournal of the American Medical Association in the 1930s and '40s didn't help. By the middle of the century, phage therapy was essentially dead in the US and Western Europe - though it continued in parts of Eastern Europe, where antibiotics were expensive and doctors continued to refine treatments and build phage libraries, indexed by the strain of bacteria they preyed upon.

In 2015, Thomas Patterson, a professor at the University of California, San Diego, was on holiday in Egypt. He became ill with a fever and stomach pain; he started vomiting, and his heart was racing. He was eventually diagnosed with an inflammation of the pancreas and, after being evacuated to Germany, an infection. The bug infecting Patterson, Acinetobacter baumannii, outmanoeuvred one antibiotic treatment after another. Physicians drained and drugged him, but the microbes continued to reproduce and cause havoc. Flown back home to California, Patterson lay in the intensive-care unit, in a coma and clinging to life after four months of hospitalisation and treatment.

Patterson's wife, Steffanie Strathdee, is an infectious disease epidemiologist. She began searching for alternative treatments and, at her request, the physician agreed to try phages. At the time, there were only a few known locations in the US that had been collecting and characterising such viruses. But as it turned out, A baumannii was also a problem for patients with combat injuries, and the US Army and Navy had already been experimenting with a relevant phage. Another option for a phage cocktail came from a university in Texas and a California-based biotech company.

Because the therapy wasn't yet approved in the US, Patterson's medical team had to obtain permission from the Food and Drug Administration (FDA) to use an 'emergency investigational new drug'. The first treatment was promising: within days, Patterson awoke after weeks in a coma. But then A baumannii began resisting the phages that had been administered. Just as bacteria can evolve resistance to antibiotics, they can develop resistance to bacteriophages. So the doctors sought a new combination of phages able to infect the resistant strain.

In the end, Patterson recovered; because he remained on antibiotics throughout the ordeal and under a great deal of medical care, it's difficult to attribute the success to any one treatment. But it's very likely that phages helped to turn the situation to Patterson's advantage. During the episode, while isolating and culturing the bug that the virus would attack, the team noticed something curious: A baumannii had apparently regained some sensitivity to antibiotics. It seemed that the phage exerted selective evolutionary pressure on the bacterium, so that it could survive the virus only by losing its antibiotic resistance. These sorts of effects had been observed decades ago, before phages slid out of Western medicine. If better understood, could this phenomenon be used to our advantage? Could evolution be used as a tool?

This is what Chan and Turner have been trying to do for the past five years. Their strategy is to find phages that can do more than simply kill offending bacteria, the way antibiotics do; they want phages that can push the right evolutionary buttons, rendering the patient's bacteria more vulnerable to antibiotics, less virulent, or even harmless. Chan and Turner call this wizardry 'evolutionary engineering'.

Phages exploit what are known as receptors: a bit of protein or other biomolecule protruding from the bacterial cell's surface. When a phage enters the bloodstream or slips into a layer of mucus, it tumbles about until it bumps into a strain of bacteria that possesses a receptor that matches its own particular needs, even if the bug is sheltering within a biofilm: unlike many antibiotics, phages can penetrate the sticky protective layer. Upon gaining access, the virus then hijacks the bacterial cell to make copies of itself, and these new phages go about infecting more bacterial cells, until there are no more left to infect. This makes phages, unlike traditional antibiotics, both a self-sustaining and self-limiting treatment.

One way that phages can help is by targeting receptors known as virulence factors, which enhance bacteria's capacity to survive and reproduce in the body. If a phage goes after a particular virulence factor, only those cells that are less virulent - and therefore less nasty for the patient - will likely survive.

Another set of targets are the factors that act as defences against antibiotics. Some resistant bacteria use certain receptors as molecular pumps, which allow them to push out the drugs before they can enter and kill the bacterial cell. Certain phages use these very same pumps for their entrance into the bug. Should a random mutation to the right receptor occur, the virus might no longer be able to penetrate the bacterium. But the twist is that this same bacterium will no longer be able to pump out antibiotics. Only those without resistance will be likely to survive. This sort of evolutionary game is the dance of life, whether it's happening in the ocean, a pond or inside a patient suffering from infection. Here, the phage is like a predator, forcing the bacteria to innovate to survive. The pressure that the virus exerts on the process of natural selection nudges the bacteria onto a pathway that enables them to withstand a viral attack - but thereby renders them vulnerable to antibiotics.

By the fall of 2017, Chan had an assortment of promising phages stowed away in his laboratory. But phages that work in a Petri dish, lab animal or even a human patient might not behave the same way when administered to another person.

The previous year, Chan had isolated a phage that saved Ali Khodadoust, an Iranian ophthalmologist in Connecticut, from a life-threatening infection. Years earlier, he had been diagnosed with a weak and bulging aorta. Doctors patched it up with mesh, but Khodadoust had been left with a nasty P aeruginosa chest infection. Antibiotic after antibiotic had failed; three years in, after multiple operations, the bug was so well-established that doctors feared that cutting it out and replacing the patch would only spread the infection. The doctor's condition was an opportunity to provide proof of concept, and save a life.

Chan had collected a sample phage known as 'OMKO1', which turned out to be a good match for Khodadoust's bug; it infected the bacteria by way of the resistance pump. Here was a chance to not only bust apart the stubborn infection, but make it respond once again to antibiotics. Chan and Turner asked for the same allowance from the FDA as Patterson's doctors had done, and it was granted.

In January 2016, Chan stood nervously outside the operating room, watching through the window as computer-guided needles delivered a combination of OMK01 and antibiotics to Khodadoust. 'This was the first application, as far as I know, with the understanding that this would be a forced trade-off and trying to capitalise on that,' Chan said. He was referring to the evolutionary give and take: the loss of a useful pump in exchange for resistance to a virus. It was a success in Khodadoust's case - but success in one patient does not make a treatment. For that, the therapy must be effective again and again. (Despite winning out over the infection in 2016, Khodadoust passed away in March 2018 after a long battle with post-operative complications, at the age of 82.)

When the doctor in Texas asked Chan if there was a phage that might help her young CF patient, Chan asked for a sputum sample. This time, there were several promising candidates, including OMK01. After gaining FDA permission as before, on 12 December 2017 Chan flew to Texas carrying a cooler with 10 tubes of a phage-saline cocktail. 'She took the first dose in the hospital with a nebuliser,' Chan recounted, 'then she nebulised at home, in the bathroom, for an hour.' By day two, she regained energy and her lungs were clearer. After 10 days of treatment, although the phage hadn't cleared the infection (CF makes it very difficult to fully eradicate infections), it did force the P aeruginosa to become sensitive to all antibiotics save one, opening many more options for treatment.

To date, no form of phage therapy has yet made its way through the long and expensive road to FDA approval, although a handful of groups, including Chan and Turner's, are getting close. As a personalised cocktail of live viruses capable of reproducing and evolving, phages are a new beast for regulatory agencies. Chan and Turner's long-term goal is to develop a library of phages that can push bacteria to evolve in the desired, even beneficial, directions. 'Ben calls it Phage Therapy 2.0,' Turner told me. But despite the hype, Turner is not a phage evangelist - he is a researcher who sees promise, he says. But there are dangers: if a phage uses a protein independent of resistance or virulence to gain access, should the bacteria evolve resistance, it could lead to a strain that continues to cause infection but now resists the phage. Worse, there is a small possibility that a nonpathogenic bystander, should it become infected by a phage, might evolve to become pathogenic.

Still, when such cases as Patterson's and Khodadoust's make the news, word gets out. Now Chan and Turner are fielding an increasing number of requests from desperate physicians or their patients. What might save more lives in the long run is the research they're doing to better understand the evolution and ecology of phages, bacteria and antibiotics. Like current work on the extraordinary influence of the human microbiome, it represents a new model of infection control: less about one-hit interventions and more about the complexity of ecological systems and evolutionary processes. These approaches incorporate the notion that the human body is not a single entity, but an ecosystem teeming with bacteria, viruses, fungi and other microscopic inhabitants. Their efforts and those of others who adopt this 'eco-evo' model of medicine might someday lead us towards a different medical paradigm - one that recognises and works with, rather than against, the invisible world thriving within, upon and all around us.