A drink of milk was off the menu for Europeans until only a few thousand years ago, say researchers from London.
Milk contains sugars that are hard to break down
Analysis of Neolithic remains, in Proceedings of the National Academy of Sciences, suggests no European adults could digest the drink at that time.
University College London scientists say that the rapid spread of a gene which lets us reap the benefits of milk shows evolution in action.
But intolerance to milk remains common in modern times, say nutritionists.
In order to digest milk, adult humans need to have a gene which produces an enzyme called lactase to break down lactose, one of the main sugars it contains.
Without it, a drink of milk proves an uncomfortable experience, causing bloating, stomach cramps and diarrhoea.
Today, more than 90% of people of northern European origin have the gene.
Working with scientists from Mainz University in Germany, the UCL team looked for the gene that produces the lactase enzyme in Neolithic skeletons dating between 5480BC and 5000BC.
These are believed to be from some of the earliest farming communities in Europe.
The lactase gene was absent from the DNA extracted from these skeletons, suggesting that these early Europeans would not be tolerant to milk.
Dr Mark Thomas, from UCL, said: "The ability to drink milk is the most advantageous trait that's evolved in Europeans in the recent past.
"Although the benefits of milk tolerance are not fully understood, they probably include the advantage of a continuous supply compared with the 'boom and bust' of seasonal crops, its nourishing qualities, and the fact that, unlike stream water, it's uncontaminated with parasites, making it safer.
"All in all, the ability to drink milk gave some early Europeans a big survival advantage."
The big question for scientists now is how the human population changed and took advantage of milk consumption.
The researchers took DNA from neolithic skulls
One theory suggests that small groups who could tolerate lactose became dominant because they could then farm cattle for milk.
But the UCL team says it is more likely that the genetic mutation allowing the digestion of milk arose at some point after dairy farming began.
Dr Thomas says the absence of the gene in the remains studied supports this theory.
If lactose tolerance had come first, the farmers would have already have had the gene.
As they did not, he suggests the genetic mutation took place at a later point.
He added: "It's likely that the gene variant arose in one individual somewhere in northern Europe, and was such an advantage, it spread quickly.
"This is probably the single most advantageous gene trait in humans in the last 30,000 years."
Anna Denny, a scientist with the British Nutrition Foundation, said 'lactase deficiency' affected about 5% of white British people, and a larger proportion of those from some ethnic minorities.
In some parts of the world, such as Asia and Africa, the vast majority of people are lactose intolerant to some degree.
Once diagnosed, the usual way to control its symptoms is to restrict the amount of milk products eaten every day, although nutritionists say that eliminating dairy products entirely is usually unnecessary.
Anna Denny said: "Lactose intolerance tends to be dose-related and some people are more sensitive than others, consequently only about a third of the people with lactase deficiency are actually lactose intolerant.
"Patients with severe lactose intolerance can usually eat yogurt, hard cheeses and lactose-reduced milk and all are encouraged to eat these as a source of calcium and other nutrients."
Some research suggests that disease-causing bugs can be passed on in milk