Viruses that selectively target and kill bacteria — also known as bacteriophages or simply phages — infect bacteria but leave human cells alone. Once they attach to a bacterial cell, they inject their genetic material, hijack the cell's machinery and force it to produce new phages until the bacterium bursts.

The problem is that bacteria can evolve defences against phages, just as they evolve resistance to antibiotics.

The new research suggests that phages have their own evolutionary countermeasure.

Some of the viruses living in the human gut can rapidly generate genetic variations among their offspring, increasing the chances that at least some will survive when bacteria fight back, according to the study, published Thursday in Nature Microbiology.

The finding could offer a new route in the search for alternatives to antibiotics, as drug-resistant infections become harder to treat.