Left: A Heliconius erato demophoon butterfly feeding on a flower in captivity. (Melanie Brien) Right: Light and dark morphs of the peppered moth.(Ilik Saccheri)

Over hundreds of years, among the dense, sun-dappled rain forests of the American tropics, a family of brilliantly colored butterflies have been evolving at breakneck speeds. Though they come in a wide range of species and forms, they share a taste for poisonous plants — which makes them unpalatable to those who might try to make them into a meal. And they've capitalized on their shared toxicity, evolving to mimic one another's wing patterns in order to send one powerful message to predators: "Things that look like us taste bad. Stay away."

More recently, but no less dramatically, another winged creature changed its form in order to avoid being eaten. When the rapid industrialization and rampant coal use of 19th century Britain coated the country's birch trees in a layer of soot, the once white-speckled peppered moth turned black, the better for blending in and keeping out of sight of potential predators.

If these stories sound familiar, that's because they're textbook cases of evolution and adaptation, taught in high school biology classrooms around the world. When the English naturalist Henry Walter Bates discovered the mimetic Heliconius butterflies during an expedition to Brazil in the mid 19th century, he held them up as evidence that Charles Darwin's theory of natural selection was correct. In a letter to Darwin not long after, entomologist Albert Brydges Farn told his friend of the curious change in peppered moths' appearances and asked, "Do these variations point to the 'survival of the fittest?' I think so."

And now we know how they were able to pull it off. A pair of studies published Wednesday in the journal Nature pinpoint the genes behind the crazy patterns of Heliconius butterflies and the dull, dark coloring of British peppered moths.

It turns out they're one and the same.

There's a kind of poetry to it, said Ilik Saccheri, an evolutionary biologist at the University of Liverpool and an author of the peppered moth study. Two cases that have helped inspire, defend and teach the theory of evolution by natural selection now have a single, potent explanation.

"We’re looking under the bonnet of this machine now and starting to gain insight rather than just imagining that evolution just happens at random," Saccheri said. 

But the identified gene, named "cortex," didn't make it easy.

Just as Darwin never understood the inner workings of evolution (scientists didn't develop the chromosome theory of inheritance until decades after his death), modern biologists have long been mystified by the genetic process that allowed butterflies and moths to change their form quickly in response to selective pressures. The mechanism seemed like it would be fairly simple; 1960s-era genetic crosses (another high school biology throwback) suggested that the variations stemmed from a single spot on the genome. But when Saccheri and his fellow evolutionary biologist Chris Jiggins, who led the Heliconius research, started to search their respective species' genomes for the kinds of genes usually involved in coloring and appearance, none of them turned out to be right.

Eventually, both groups, working separately, narrowed in on cortex. It was a surprising candidate, Jiggins said, because in the most studied insect organism, fruit flies, the cortex gene controls how cells split up and multiply.

"It's not obviously the kind of gene you’d expect to be setting up patterns," he said. 

Even more surprising was the discovery that both men were examining the same gene. Jiggins is based at the University of Cambridge and wasn't involved in Saccheri's research (and vice versa) but the two are friends. A couple of years ago, after they'd both published papers identifying the area around cortex as a good candidate spot on the chromosome, they reached out to one another to compare results.

"It's amazing because [Heliconius and peppered moths] haven't had a shared ancestor in over 100 million years," Saccheri said. "They are deeply diverged species with different numbers of chromosomes." And yet, "this gene is quite conserved."

"We thought it was pretty cool," Jiggins said, so the pair decided to submit their studies to the same journal and release them at the same time.

Just as studies of Heliconius and peppered moths once helped illuminate the macro process of natural selection, the researchers hope their studies will illuminate how evolution happens at a microscopic level.

Saccheri was able to trace the genetic variant responsible for black peppered moths (rather than speckled white ones) back to 1819, around the peak of British coal burning. That's less than 30 years before the black variant was widespread enough that people began commenting on it in the historical record — indicating that it didn't take long for the trait to spread throughout the species.

He believes that the cortex gene shows that there are "hot spots" for adaptation — places on the genome that are particularly good at mutating and developing variations in response to selective pressures.

"It's a somewhat contentious idea, because traditionally we assume that there’s a blank canvas if you like upon which mutations just rain down and it's entirely random," he said. "But that's a bit naive."

"This system, this machine, has been evolving for a very long time," he added. It's not unreasonable to expect that it would have evolved a better mechanism for evolving. 

All that is a subject for future research — as is the process by which a variant of the cortex gene can lead to differences in pattern and color.

For now, Saccheri hopes that his study will help people appreciate the power of natural selection.

"My hope is that by adding more scientific evidence, more modern scientific evidence, to this case study that eventually it will kind of make it easier for people to appreciate at different levels this isn’t a made up story," he said. "There’s more and more layers of evidence."

Read more:

This rare butterfly is half male, half female

How have anti-evolution tactics evolved over time? They've gotten sneakier.

40 million years before butterflies existed, this creature evolved with strikingly similar looks

Debunking the myth that evolution can't explain eyeballs

Snake venom evolved to kill specific squirrels with shocking precision

How did the giraffe get its improbable neck? Genetic analysis finds some clues.