The ability to digest milk may have become common only relatively recently in Europe, a major study of ancient DNA shows.
The analysis of genomes from 101 ancient adults suggests the gene for breaking down the lactose sugar in milk was still rare in the Bronze Age.
The results come as something of a surprise because the gene is widespread among modern Europeans.
The research by an international team is published in Nature journal.
The findings illuminate a debate over migrations during the Bronze Age (3,000-5,000 years ago), which - according to the picture emerging from ancient DNA research - was a particularly dynamic period.
"It seems like the Bronze Age is the period where the genetic diversity and distribution that we know today is basically formed," co-author Prof Eske Willerslev, from the University of Copenhagen, Denmark, told BBC News.
The study shows that people of European origin penetrated en masse into Central Asia where they became known as the Sintashta culture. And a population from Europe's eastern periphery called the Yamnaya, who carried ancestry also found in Native Americans, pushed far into northern and central Europe.
The team was able to look at some of the genetic characteristics of these ancient individuals. One thing that stood out was the scarcity of a variant in the gene (called LCT) that codes for lactase, an enzyme that breaks down lactose.
The ability in adulthood to break down lactose is rare or absent in most parts of the world. Those without the mutation can experience unpleasant side effects if they consume substantial amounts of milk.
"The ability to drink milk is a very unique European feature - you also find it in a few African groups, but there it is due to different mutations," said Prof Willerslev.
Researchers had previously linked the emergence of lactose tolerance to the Neolithic period, when domestic cattle were introduced to Europe by Anatolian farmers. But Neolithic genomes haven't turned up any evidence of an increase in the trait at this time.
"At the end of the Bronze Age, this genetic ability is still extremely rare," said Eske Willerslev, describing the result as a surprise.
"We see a slight increased frequency not in Europe but to the east, on the steppe. One possibility is that after the Bronze Age, this genetic ability was brought into Europe and is then selected for."
On the edge
Computer modelling work by Mark Thomas from University College London, UK, and colleagues has placed the start of the selection process in the Middle Neolithic. But, Prof Thomas explained: "It could be that it's not becoming visible in Europe until later because it takes time to rise to frequency. Or maybe it did evolve later. Or... it initially evolves in a region that hasn't been looked at using ancient DNA, then spreads to other regions later."
What has been really lacking is agreement over what's driving the gene frequency up - it's selective advantage. The classic explanation is that milk provides people with vitamin D, a particular advantage in northern Europe where humans are less able to make it through the action of sunlight on the skin.
But that reasoning doesn't work for Southern Europe, the Middle East or Africa, where lactase persistence is also found.
Prof Thomas told BBC News: "In my view there are a range of other explanations. One is that milk is just good for you - it's a 'superfood'. Another is that it is a good source of uncontaminated fluid. Yet another... is that populations have been dairying for a long time, but they've been fermenting the milk to make butter fat, yoghurt and cheese.
"Imagine you have a population with a mixed economy and their crops fail. They're going to become more dependent on fermented milk products and they're going to be somewhat malnourished. After that runs out, they're just going to be left with milk.
"If you are severely malnourished and you eat something that gives you diarrhoea, you're at serious risk of dying because of fluid loss and so on. So the times when people needed to consume unfermented milk were exactly those when you don't want diarrhoea. It might have generated really intense bursts of selection for those who were lactase persistent."
"I suspect that only more ancient DNA data will enable us to pin down why lactase persistence spread so quickly."
Dr Abigail Bouwman, from the University of Zurich, echoed the view that the selective advantage of this trait was greater when unprocessed milk was required. She told BBC News: "I would posit that the reason the Bronze Age LCT frequency is quite low despite the long history of cattle domestication and even dairying, is due to a combination of unprocessed milk not being essential for survival and the fact that the mutation(s) that allow for lactase persistence are spontaneous.
She added: "The European allele is only one mutation. It takes a while for one person's genetic heritage to spread to significant number of descendants."
Age of empires
The discovery that the Yamnaya, or a population like them, left an important mark on the genetic landscape of Europe backs up previous findings by a team led by Prof David Reich of Harvard Medical School, US.
Variation in the amount of Yamnaya ancestry seems to account for many of the genetic differences between people in southern and northern Europe.
These nomadic, horse-riding pastoralists, with their ox-driven wagons, buried the dead in earthen mounds called kurgans. They may also have helped spread languages belonging to the Indo-European family. Today, most of the languages spoken in Europe belong to this group, with a few exceptions such as Basque.
"Here we can see from the data that the spread of Indo-European languages fits very well with the spread of the Yamnaya culture," said Eske Willerslev.
The study also shows that the Yamnaya spread east into Central Asia, only to be replaced around 2000BC by a warlike, chariot-riding group that archaeologists know as the Sintashta culture. Contrary to suggestions, these incomers had an Asian origin. Analysis of their genomes links them to Bronze Age Europeans, suggesting a mass movement from west to east.
Follow Paul on Twitter.