Researchers knew that bacteria rely on fibers called pili to capture foreign DNA. But the exact details have remained elusive because pili — more than 10,000 times thinner than human hair — are so hard to observe, said Lori Burrows, a professor of biochemistry and biomedical sciences at McMaster University in Ontario who was not involved in the study.

“It’s cool to actually see this in action,” she said.

[Like the Science Times page on Facebook. | Sign up for the Science Times newsletter.]

We typically think of genes as passed down vertically, from parent to offspring. But there are also processes called horizontal gene transfer, in which DNA moves laterally between organisms that are not parent and child.

Natural transformation is one example, and it’s an important way in which bacteria, which typically reproduce asexually, introduce variation and new traits into their genetic code, said Ankur Dalia, an assistant professor of biology and an author of the new paper.

The process has mesmerized biologists since 1928, when a British bacteriologist named Frederick Griffith stumbled across it while searching for a pneumonia vaccine.