Chocolate has been around for millennia. New research suggests it’s even older than we thought.

New research puts the origins of domesticated cacao in South America — 1,500 years earlier than previously believed.

It’s Halloween, which means for a lot of us, it’s time to eat a lot of soon-to-be-extremely-discounted fun-size chocolate bars. And just in time for the occasion, a team of researchers with an excellent sense of seasonal timing have shed some new light on the origins of chocolate — challenging a lot of long-held beliefs about where the so-called “food of the gods” comes from.

As archaeologists have generally understood it, chocolate goes back to the Aztec and Mayan people, who first domesticated cacao in what’s now Central America about 3,900 years ago. But new research suggests it’s older than that — about 1,500 years older. And it didn’t originate in Central America, either.

According to a new paper published in the journal Nature Ecology & Evolution, domesticated cacao — the raw ingredient for chocolate — can in fact be traced farther south, to the upper Amazon in South America.

For the average contemporary chocolate eater, this might seem like merely an interesting historical detail: We thought chocolate was old, but in fact, it is very old! But according to Sonia Zarrillo, an anthropological archaeologist at the University of Calgary and one of the lead authors on the study, the findings have significant implications for our understanding of ancient cultures — and may hint at the future of chocolate production.

Geneticists have long suspected cacao might have been domesticated in the Amazon — but there wasn’t proof

Of the 22 species of cacao trees, only one has really been domesticated. And while there are different varieties of domesticated trees, they’re all called the same thing: Theobroma cacao.

But where Theobroma cacao was domesticated has been a matter of debate. The prevailing idea is that it happened in Mesoamerica, Zarrillo explains. We know that the Maya and the Aztecs and even the people before that, going back 3,900 years, were using domesticated cacao. The plant was “part of every aspect of their lives,” she says: The seeds were used as currency; chocolate-based drinks, especially frothy ones, were used in religious rituals, served from special vessels designed explicitly for that purpose. It was such an important part of their culture, Zarillo says, that people thought it must have been domesticated there.

There were reasons to suspect otherwise, though: For one thing, there are very few wild Theobroma trees growing north of Panama — let alone up into Mexico. And so for decades now, plant geographers have suggested an alternative theory: that cacao was domesticated in the upper Amazon, because that’s where the greatest variety of wild cacao trees are. “That’s just how domestication works,” Zarrillo says. “Where you have the greatest genetic diversity, you’ll find — in almost every case — the origins of that crop.”

And she and her colleagues found the first hard evidence to back up this theory.

Zarrillo and her colleagues looked at the residue in vessels and pots (or shards of pots) from the Santa Ana La Florida site in Ecuador, in the upper Amazon — an area first occupied by the Mayo-Chinchipe people about 5,450 years ago, based on radiocarbon dating.

And in that residue, they found evidence of domesticated cacao. First, Zarrillo determined that there was cacao starch in the residue, but she couldn’t tell whether the starch was domesticated cacao or wild. To parse the difference, the team tested the samples for theobromine, a particular biochemical compound that is found in domesticated cacao but not in wild cacao. (It’s the caffeine-like stimulant in chocolate, and also enhances flavor.) Just over a quarter of the samples had it — more evidence. Finally, they extracted DNA from the residue, again looking for mutations exclusive to domesticated cacao. And they found them.

“What that told us was that, yes, we had domesticated cacao. And not only did we have domesticated cacao, but they were also using wild varieties at the same time,” Zarrillo says. The team was also able to get a radiocarbon date on one of the domesticated samples: 5,300 to 5,400 years ago. “We’re showing that here we have domesticated cacao, right in the region where geneticists and others have said it should have been domesticated, and it’s 1,500 years earlier than the earliest evidence so far that’s been found in Central America and Mesoamerica.”

The findings suggest the Amazons had a more sophisticated culture than previously believed

While cacao may have been domesticated in the upper Amazon, the people there were using it in a pretty different form than the Aztecs or the Maya. In Mesoamerica, people toasted and ground the cacao seeds, making a chocolate paste to use in various drinks. There’s documentation of this, in writing by Mesoamericans themselves and in records from the Spanish conquistadors. “If the ancient Mesoamericans hadn’t developed this chocolate drink, we wouldn’t have chocolate today,” Zarrillo tells me.

Right now, we know less about how people in the Amazon consumed the stuff, but according to Zarrillo, the most likely scenario is that they were using it to make fresh and fermented drinks — much like a lot of fermented drinks still common in the region, only made with cacao instead of something like corn.

The takeaway here isn’t just about chocolate; like everything else, it’s about people. “For hundreds of years, the people of the Amazon have been portrayed as these very simple people, intellectually but also in their social formation — living in small tribes, moving from place to place, barely eking out a living, always on the brink of death,” Zarrillo says. “And what’s been emerging is that, no, these people had very sophisticated culture. They weren’t just barely surviving in the Amazon; they’d actually transformed the Amazon into their living garden.”

There’s also a potentially pragmatic application: saving the contemporary cacao crop. “Like many other crops,” the New York Times explained last year, “cacao is under constant threat from diseases and environmental challenges exacerbated by our tendency to grow only a few varieties with similar or identical genetic traits and defects.”

Zarrillo sees her team’s research as a potential salve. “Looking at this ancient cacao and where it comes from really spurs us to think about the many other varieties of cacao, and how these wild plants can probably help to save modern cacao.”