Migration between different communities of bacteria is the key to the type of gene transfer that can lead to the spread of traits such as antibiotic resistance, said researchers from Oxford University.

While horizontal gene transfer - also known as bacterial sex - has long been acknowledged as central to microbial evolution, why it is able to exert such a strong effect has remained a mystery till date.

Now, Oxford scientists have demonstrated that the secret is migration.

It is well known that bacteria are able to swap little pieces of DNA, which is crucial for them to be able to evolve and adapt to new environments, including responding to antibiotics.

"It is different to sex in humans but the effect - swapping genetic material - is similar," said Kevin Foster, professor of evolutionary biology.

However, sex in bacteria is a very rare event, with only one cell among millions swapping DNA.

"In theory, any resistant strain will rapidly divide and take over the community, shutting down any opportunity to share the resistance gene with others," Foster added.

But, it does keep happening, and genes are often able to hop through diverse groups of different bacteria. Until now, the mystery has been why.

This migration between communities of bacteria can take place anywhere, from the human body to soil.

While antibiotic resistance is a good example of a beneficial trait passed horizontally between microbes, it could also involve being able to survive in an environmental toxin or on a particular nutrient.

The study sheds new light on how the spread of traits such as antibiotic resistance happens.

"Our model offers a theoretical framework for understanding the processes behind the bacterial spread," added study co-author Rene Niehus.

The study is published in the journal Nature Communications.