WHY do ferns still exist? That may sound an odd question, but it isn’t. Ferns dominated the botanical world for hundreds of millions of years, between the Devonian, about 360m years ago, and the rise, about 120m years ago in the Cretaceous, of the flowering plants familiar today. When that happened, though, most ferns could not stand the competition and were driven to extinction. One group alone prospered and diversified. Almost all ferns now alive are its descendants.

The secret these ferns share is an ability to live in the shadows of their competitors. And that, suggests research just published by Fay-wei Li of Duke University in North Carolina in the Proceedings of the National Academy of Sciences, is the result of an extraordinary accident long ago which means the ferns in question are not actually 100% fern.

Modern ferns’ success in the shade depends on a protein called a neochrome. This molecule enables them to respond simultaneously to red and blue light in both the way that they grow and the way the photosynthetic elements in their cells, the chloroplasts, organise themselves. Most plants respond best to blue light, which has most energy in it. But if overarching flowering plants have already sucked out the blue then an ability to respond to red as well is an advantage.

Neochrome’s response to both ends of the spectrum is a result of the gene encoding it being a merger of bits of two other genes. One ancestor is the gene for a red receptor called a phytochrome. The other is for a blue receptor called a phototropin. In an attempt to understand how this merger happened, Mr Li and his colleagues searched the 1000 Plants Initiative, a DNA database at the University of Alberta, in Canada, to construct an evolutionary tree for the molecule and its two components.

What they found shocked them. Before they conducted their search, the only known non-fern neochrome was in a small group of algae. That appeared to be a coincidence; a case of convergent evolution. But their investigations revealed that in addition to these algae a group of primitive plants called hornworts, which are related to mosses but not closely related to ferns, have a neochrome too. This might have been convergent evolution, as well, of course. But closer analysis showed it was not. Instead, the evolutionary tree of fern neochrome fits neatly inside the evolutionary tree of hornwort neochrome. The original gene for fern neochrome—the gene that, in all probability, saved ferns from obscurity—formed in a Mesozoic hornwort and then somehow passed to a Mesozoic fern.

In essence, this is the same process of gene transfer from one species to another that is used artificially to make genetically modified crops. Such a transfer might have happened naturally by a virus picking up the relevant gene and carrying it across the species boundary. Or it might have occurred in the rough-and-tumble of everyday life as a tiny fern grew up abutting a hornwort. The details will probably never be known. But that chance event, which happened, Mr Li’s calculations suggest, about 180m years ago, probably explains why ferns are still around and thriving.