When you drink a glass of your favorite red or white, you may not always think about the processes that brought the wine to you in that moment. And not just the winemaking that went into that particular bottle, but the long, long history of turning grapes into alcohol.

That journey began about 11,000 years ago, according to a new study reported on by The Washington Post. In a paper published Thursday in the journal Science, a global cohort of researchers trace the domestication of grapevines all the way back to prehistory, eventually leading to the earliest-known winemaking 8,000 years ago.

“The grapevine was probably the first fruit crop domesticated by humans,” Wei Chen, a senior author of the paper and an evolutionary biologist, said in a media briefing.

Using genomic analysis, the researchers found that domestication actually happened twice, on two different lineages of wild grapes: One example occurred in the Caucasus region, while the other happened in western Asia. The authors believe that the Caucasus grapevines developed into those chosen for their winemaking potential, while those in western Asia were used as a food source. Eventually, the latter grapes were mixed with wild ones to create the wine-producing grapes found in western Asia and Europe, including regions in the Mediterranean well known for their wine.

While there are several different species of grapevine, just one is used for creating the vino you find yourself drinking at home or in a restaurant: Vitis vinifera. Popular grapes like MerlotCabernet Sauvignon and Pinot Noir are all varietals of that species. Wild grapes with an ancient lineage also still exist, but they tend to be smaller and more bitter. However, they’re valuable today thanks to their ability to withstand diseases and climate change.

“These wild grapes and these very old varieties still have these resilience genes, which we will need to render the grape resistance against the challenge of climate change,” Peter Nick, a co-author on the study and a plant biologist, told the Post.

While the new research provides a look into how prehistoric humans developed agricultural practices, it doesn’t give a definitive answer as to when people actually started fermenting grapes to make wine. But you most certainly have our early ancestors to thank for your oenophile tendencies.