At the height of its empire, the inhabitants of ancient Rome genetically resembled the populations of the Eastern Mediterranean and Middle East, according to a DNA study published Thursday.

The paper is based on genome data of 127 individuals from 29 archaeological sites in and around the city, spanning nearly 12,000 years of Roman prehistory and history.

Rome and central Italy's antiquity is well-documented in the rich archaeological and historical record, but relatively little genetic work had been carried out until now.

Writing in the journal Science, researchers from Stanford and Italian universities said people from the city's earliest eras and from after the Western empire's decline in the 4th Century CE genetically resembled other Western Europeans.

But during the imperial period, Romans had more in common with populations from Greece, Syria and Lebanon.

The earliest sequenced genomes, from three individuals living 9,000 to 12,000 years ago, resembled other European hunter-gatherers at the time.

Starting from 9,000 years ago, the genetic makeup of Romans again changed in line with the rest of Europe following an influx of farmers from Anatolia or modern Turkey.

Things started to change however from 900 BCE to 200 BCE, as Rome grew in size and importance, and the diversity shot up from 27 BCE to 300 CE, when the city was the capital to an empire of 50 million to 90 million people, stretching from North Africa to Britain to the Middle East.

Of the 48 individuals sampled from this period, only two showed strong genetic ties to Europe.

The genetic "diversity was just overwhelming," added Ron Pinhasi of the University of Vienna, who extracted DNA from the skeletons' ear bones.

After the empire split into two parts with the eastern capital in Constantinople (now Istanbul), Rome's diversity decreased once more.

"The genetic information parallels what we know from historical and archaeological records," said Kristina Killgrove, a Roman bioarchaeologist at the University of North Carolina at Chapel Hill, who wasn't involved in the study.

Jonathan Pritchard, a population geneticist at Stanford University who sequenced and analyzed the DNA, said mass migration is sometimes thought to be a new phenomenon.

"But it's clear from ancient DNA that populations have been mixing at really high rates for a long time," he added.