When it comes to the origin of Western fairy tales, the 19th century Brothers Grimm get a lot of the credit. Few scholars believe the Grimms were actually responsible for creating the tales, but academics probably didn’t realize how old many of these stories really are. A new study, which treats these fables like an evolving species, finds that some may have originated as long as 6000 years ago.

The basis for the new study, published in Royal Society Open Science, is a massive online repository of more than 2000 distinct tales from different Indo-European cultures known as the Aarne–Thompson–Uther Index, which was compiled in 2004. Although not all researchers agree on the specifics, all modern Indo-European cultures (encompassing all of Europe and much of Asia) descended from the Proto-Indo-European people who lived during the Neolithic Period (10,200 B.C.E.–2000 B.C.E.) in Eastern Europe. Much of the world’s modern language is thought to have evolved from them.

To conduct the study, Jamshid Tehrani, an anthropologist at Durham University in the United Kingdom, and colleagues scanned the repository. They limited their analysis to tales that contained magic and supernatural elements because this category contained nearly all the famous tales people are familiar with. This narrowed the sample size to 275 stories, including classics such as Hansel and Gretel and Beauty and the Beast.

But tracing these tales back through time is no easy task. There are scant historical records, and many of the fables began as oral stories that left no written versions. So the researchers used statistical methods similar to those employed by biologists to trace species lineages back through the branching tree of evolution based only on modern DNA sequences.

Here’s how it worked: Fairy tales are transmitted through language, and the shoots and branches of the Indo-European language tree are well-defined, so the scientists could trace a tale’s history back up the tree—and thus back in time. If both Slavic languages and Celtic languages had a version of Jack and the Beanstalk (and the analysis revealed they might), for example, chances are the story can be traced back to the “last common ancestor.” That would be the Proto-Western-Indo-Europeans from whom both lineages split at least 6800 years ago. The approach mirrors how an evolutionary biologist might conclude that two species came from a common ancestor if their genes both contain the same mutation not found in other modern animals.

But it’s not quite so simple. Unlike genes, which are almost exclusively transmitted “vertically”—from parent to offspring—fairy tales can also spread horizontally when one culture intermingles with another. Accordingly, much of the authors’ study focuses on recognizing and removing tales that seem to have spread horizontally. When the pruning was done, the team was left with a total of 76 fairy tales.

This approach allowed the researchers to trace certain tales, such as The Smith and the Devil, which tells the story of a blacksmith who makes a deal with the devil in exchange for unmatched smithing prowess, back thousands of years—all the way to the Proto-Indo-European people. If the analysis is correct, it would mean the oldest fairy tales still in circulation today are between 2500 and 6000 years old. Other stories seem to be much younger, appearing for the first time in more modern branches of the language tree.

The authors have done “as good a job as possible,” with the data they have, says Mark Pagel, an evolutionary biologist at the University of Reading in the United Kingdom.

In a new dispatch, published this month in Current Biology, he ruminates on what allows these stories to stand the test of time. “What really interests me is why these cultural forms exist. Why is it that fairy tales, art, songs, poems, why do these things seem to have such longevity?”

Tehrani says that the successful fairy tales may persist because they’re “minimally counterintuitive narratives.” That means they all contain some cognitively dissonant elements—like fantastic creatures or magic—but are mostly easy to comprehend. Beauty and the Beast, for example, contains a man who has been magically transformed into a hideous creature, but it also tells a simple story about family, romance, and not judging people based on appearance. The fantasy makes these tales stand out, but the ordinary elements make them easy to understand and remember. This combination of strange, but not too strange, Tehrani says, may be the key to their persistence across millennia.

“This is of course something we now need to test more rigorously,” he says. “That’s the next phase of this research.”