Early Europeans had a problem drinking the milk of cows and goats for about 5,000 years after the introduction of farming, a University College Dublin study has found.

It took at least that long for their genes to evolve until they were no longer intolerant to lactose, the natural sugar in mammalian milk.

Scientists looked at ancient DNA extracted from 13 individuals buried at archaeological sites in the Great Hungarian Plain.

The region is known to have been at the crossroads of cultural change in European prehistory.

The samples were taken from the petrus bone, a hard part of the skull protecting the inner ear, and dated from 5,700BC to 800BC.

Lead researcher Professor Ron Pinhasi, from UCD's Earth Institute, said: "Our findings show progression towards lighter skin pigmentation as hunter and gatherers and non-local farmers intermarried, but surprisingly no presence of increased lactose persistence or tolerance to lactose.

"This means that these ancient Europeans would have had domesticated animals like cows, goats and sheep, but they would not yet have genetically developed a tolerance for drinking large quantities of milk from mammals."

The findings appear in the online edition of the Nature Communications journal.