When Black Death ripped the heart out of Europe in the 14th century, it was the devil who often copped the blame. It would be centuries before the true culprit would be identified at the end of a microscope.

For much of history disease has attracted supernatural explanations. In spite of this, anthropologists have had a hard time supporting hypotheses that link the evolution of spiritual beliefs with public health practices. This new research might change that.

A large international team of researchers uncovered strong statistical evidence matching the prevalence of various pathogens with high levels of moral vitalism – better known as a belief in spiritual forces of good and evil.

The results suggest that in a world where invisible agents of infection spread unchecked, moral vitalism might reinforce actions that keep contamination to a minimum in what's referred to as a function of our 'behavioural immune system', in turn reinforcing those beliefs.

"By providing a framework for predicting the spread of infectious disease, moral vitalism would also have facilitated (or at least cognitively justified) behavioural strategies designed to limit infection," the researchers write in their report.

From ancient times to the modern age, there's no shortage of examples illustrating how we imagine a relationship between evil and illness. Whether in the form of individual exorcisms or pogroms aimed at wiping out entire populations, morality and disease have long gone hand-in-hand.

That link raises some interesting questions. Could the spread of disease have affected the evolution of those moral beliefs? Could those beliefs, in turn, have influenced the spread of pathogens?

To find out, the research team ran several studies analysing data in search of trends that showed whether moral vitalism might reduce the risk of catching a communicable disease, and therefore have an adaptive advantage.

The first two studies explicitly looked at witchcraft and a belief in the evil eye, as well as a belief in what we'd commonly identify as the devil.

Using models that compared these beliefs across different cultures with the prevalence of pathogens, including malaria, typhus, and dengue, the researchers found there was, in fact, a strong relationship. The more prevalent a disease, the more likely a belief in witchcraft, the evil eye, or the devil itself existed in that part of the world.

Finding that a belief in ol' Splitfoot is more common in places where disease spreads easily is a nice start, but does little to show whether one affects the other in any way.

Past research already hints strongly at relationships between socioeconomics and religiosity, for example, suggesting other cultural forces could be at work, promoting both the risk of disease and tendency to subscribe to a supernatural belief.

So the team hit the question more directly in a third study, conducting a large, multinational survey intended to measure moral vitalism and the healthcare behaviours of individuals.

Not only did this allow the researchers to better examine the question on a personal level, it helped control for other variables that have been linked with both moral vitalism and the historical prevalence of pathogens.

Just over 3,100 students from universities across 28 countries around the world contributed survey results to the final analysis, which showed a fairly robust association between a supernatural belief in good and evil and behaviours that help avoid coming into contact with pathogens.

Taken together, the results provide solid evidence that by believing in dark forces that harm the body, people were more likely to avoid coming into contact with deadly pathogens, meaning moral vitalism wasn't just primitive superstition, it was a functional behaviour.

"In this way, moral vitalistic beliefs may represent a psychological mechanism that conferred an adaptive advantage within environments characterised by a high pathogen load," the researchers write.

Considering that tendencies to see the world in shades of good and evil is favoured by more conservative people and further reinforced by in-group thinking, it's not hard to see how the devil quickly found himself right at home in plague-ravaged communities.

For medical anthropologists interested in our so-called behavioural immune system, the study confirms suspicions that moral forces don't just affect how we deal with health and disease, but that they're shaped by it in return.

None of this is to say there can't be a variety of influences shaping beliefs in supernatural forces, and it certainly doesn't mean a belief in witches comes close to what modern medicine has achieved when it comes to conquering the germ.

But studies like these do help us to better understand the kinds of historical pressures that put the details into the devil.

In a world where science and religion can often butt heads over how to manage health and wellbeing, it's vital we learn all we can about the interplay between culture and the spread of disease.

This research is published in Proceedings of the Royal Society B.