The plagues of the Middle Ages have left about 10% of Europeans resistant to HIV, researchers have said.
Biologists at the University of Liverpool say a gene mutation developed in response to pestilences such as the Great Plague of London in 1665-66.
The mutation - known as CCR5-D32 - also stops the HIV virus from entering the immune system.
The gene is more prevalent in Russia, Poland, Hungary and Scandinavia where plagues continued until about 1800.
'Restricted to Europe'
But there are relatively low levels of the gene in people living near the Mediterranean.
The research, by Professor Christopher Duncan and Dr Susan Scott is published in the March edition of Journal of Medical Genetics.
Prof Duncan said: "The fact that the CCR5-D32 mutation is restricted to Europe suggests that the plagues of the Middle Ages played a big part in raising the frequency of the mutation.
"These plagues were also confined to Europe, persisted for more than 300 years and had a 100% case mortality."
The research said that the mutation was not linked to bubonic plague, which is a bacterial disease, rather than a virus, and is not blocked by the gene mutation.