The human genome is three billion letters long. About 240 million letters of it, scientists estimate, is viral. Yes, eight percent of human DNA comes from ancient viruses that once infected our ancestors.

Most viral infections are as fleeting as a cold, but two things made the ancient ones unusual: One, these viruses had the special ability to copy themselves into the DNA of their hosts. And two, they sometimes got lucky enough to copy themselves into an egg that became fertilized and grew into a full-fledged adult. So that viral DNA got passed down from generation to human generation as so-called endogenous retroviruses.

But there’s no need for alarm about the DNA of viral origin teeming inside your cells. Some of it may even make you you. As a growing fetus, you co-opted a gene from an ancient virus to form the placenta that kept you nourished in the womb. And in recent years, scientists poring over gigabytes of genetic sequencing data have seen other tantalizing hints of endogenous retroviruses turning useful. A new paper out today in Science suggests humans have also co-opted the remnants of ancient viruses to direct the immune system against other pathogens. Ah, the irony. “The tables have been turned,” says Nels Elde, a biologist at the University of Utah and coauthor of the study. “We’ve claimed those elements to fight off modern viruses.”

To piece together the story, the University of Utah team first trawled through previously published genomic data, looking for stretches of DNA that bind to a molecule known for switching immune cells into attack mode. When that molecule binds to DNA, it turns on nearby genes whose products fight pathogens. Many of those binding stretches of DNA in fact looked like a virus called MER41, which infected a monkey-like ancestor of humans some 45 to 60 million years ago.

But that’s just correlation. To prove that the old virus was actually *causing *the immune switch, the scientists moved from the computer to the lab bench. When they used a gene-editing technique called CRISPR-Cas9 to knock out MER41 sequences in human cells, those cells could no longer mount an immune response. DNA from an ancient virus, it seems, has now become a vital part in fighting new viruses.

Neither part of this study—the DNA sequencing nor the CRISPR-Cas9 editing—would have been possible, or at least as easy, until very recently. “These kinds of technologies are unmasking some of the tricks nature has used to achieve types of gene regulation,” says Samuel Pfaff, a geneticist at the Salk Institute.

Gene regulation is why a brain cell is different from a blood cell is different from a kidney cell—even though they all have the same set of genes in their DNA. Gene regulation also controls an embryo of undifferentiated cells growing its brain and blood and kidneys. And that process in mice, at least, is also under the influence of endogenous retroviruses. In 2012, Pfaff and his colleagues published a paper showing regulatory sequences that once existed to regulate viral genes had been co-opted to control mouse development genes.

The placenta example points to a second way for endogenous retroviruses to turn beneficial: if their viral genes are straight up reused in new way. The same gene that allowed a virus to fuse to a mammal cell now lets cells of the placenta fuse together to form the organ. Interestingly, primates and mice and rabbits and cats all got their placental genes from separate viral infections. Not only does this endogenous retrovirus-turned-good story happen, but it’s happened multiple times.

The question now is whether the role of endogenous retroviruses in the immune system is similarly widespread among animals. “Do they contribute on a major scale or are there just a few small cases? The questions is whether it opens new vistas,” says Jonathan Stoye, a retrovirologist at the Francis Crick Institute. With technology like next-generation DNA sequencing and CRISPR-Cas9, there’s no better time to look for those vistas than now.