The secrets of our ancestors might hold the key to why multiple sclerosis (MS) is more common among white, northern Europeans than among Europe's more southern populations.

While scientists have found hundreds of genes to date that are associated with MS, up to a fifth of northern Europeans have a genetic variant, called HLA-DRB1*15:01, that conveys a threefold higher risk of developing the autoimmune disease.

Where this variant came from and why it persisted and spread is a mystery.

An international team of researchers, led by William Barrie from the University of Cambridge, now thinks they are on to a new lead.

Barrie and his colleagues combined dozens of newly sequenced Medieval and post-Medieval Danish genomes with a database of ancient sequences to come up with a database of individuals representing tens of thousands of years of humanity across Eurasia. Among these, they found "striking patterns" in the gene variants associated with MS today.

Working backwards to trace the prevalence of the variants through time, the genes seemed to originate in a region of eastern Europe that now encompasses Ukraine, South-West Russia, and West Kazakhstan, called the Pontic Steppe.

Around 5,000 years ago, pastoralists in this region, called the Yamnaya, migrated west into northern Europe, taking their genes with them.

Wherever these genes went, the MS-associated variants appeared to undergo 'positive selection', which suggests they once held some survival value despite their modern link to neurocognitive decline.

"This means we can now understand and seek to treat MS for what it actually is: the result of a genetic adaptation to certain environmental conditions that occurred back in our prehistory," says neuroimmunologist Lars Fugger from the University of Oxford.

MS is caused by the body's immune system attacking itself by mistake, and while this can lead to devastating consequences when unchecked, theoretically, an overactive immune system could also protect from pathogens and plagues.

This may have given ancient people an advantage, especially as they developed animal husbandry and settled into dense populations, where illnesses might run rampant.

When comparing their data to around 410,000 contemporary human genomes in the UK Biobank, researchers found that the frequency of the HLA-DRB1*15:01 variant was "highest in modern populations from Finland, Sweden and Iceland and in ancient populations with a high proportion of steppe ancestry."

"These results astounded us all," says Barrie.

"They provide a huge leap forward in our understanding of the evolution of MS and other autoimmune diseases. Showing how the lifestyles of our ancestors impacted modern disease risk just highlights how much we are the recipients of ancient immune systems in a modern world."

In a recent review of the paper for Nature, science writer Lionel A. Pousaz and genomics researcher Samira Asgari, write that Barrie and his team's hypotheses are "valid" but require "more concrete evidence".

"Their findings reveal the reasons that underlie the north–south gradient in Europe and point to the potential evolutionary advantage that multiple sclerosis risk variants could have had in the post-hunting-and-gathering era," the duo write.

"However, future work is needed to confirm the suggested association between infectious diseases and multiple sclerosis risk."

The study was published in Nature.