Where did the spiritual concept of evil originate? One possible explanation might be people's attempts to understand and cope with infectious diseases.

Linking diseases and their symptoms to mysterious evil forces is a practice that emerged in traditional belief systems prior to the mid-19th century, when germ theory was introduced, scientists wrote in a new study. Germ theory revealed that microscopic pathogens, rather than malevolent spirits, were the cause of illness.

However, the connection between religious convictions about good and evil and the presence of infectious disease lingers today, the researchers discovered. They found that, in geographic regions with high incidences of disease, people also demonstrated stronger convictions about agents of evil, such as demons and witches.

Related: Black Magic: 6 Infamous Witch Trials in History

Historically, many cultures in Africa, Asia, Europe and North America have used supernatural forces to explain and guide their responses to disease. One notable example was the surge in witch hunts in medieval Europe when the continent was ravaged by the Black Death, the researchers reported.

This approach had a practical side: Sick people — those showing signs of a so-called evil influence — would be isolated, shunned or even killed, thereby protecting others from the spread of pathogens, according to the study. In turn, environments where infectious diseases were common would reinforce conservative ideologies that followed a strict practice of shared rituals and avoidance of strangers.

If spiritual beliefs in evil were more common in regions that carried a higher load of pathogens, "it suggests that historically these beliefs may have evolved to explain the effects of pathogens," lead study author Brock Bastian, an associate professor with the School of Psychological Sciences at the University of Melbourne in Australia, told Live Science in an email.

"It opens up new insights into the emergence of religion as a belief system that developed to explain natural threats or events," Bastian said.

Witches, the devil and the evil eye

To test that hypothesis, the researchers conducted surveys and consulted archival data to assess levels of belief in evil. They surveyed more than 3,000 university students in 28 countries, investigating whether the participants believed strongly in the evil eye (a person's ability to cast a curse "through a malevolent glare"), witchcraft, the devil and unspecified evil forces. Archival data from around 58,000 people across 50 countries, collected between 1995 and 1998, addressed the question of the subjects' belief in the devil. In their evaluations, the scientists noted individuals' social class, level of education, political orientation and strength of religious practice.

The researchers also examined global historical data of infectious diseases, comparing those patterns with geographic trends in spiritual beliefs about evil.

Related: Spooky! Top 10 Unexplained Phenomena

They learned that, in places where infectious diseases were historically widespread, "people were more likely to believe in the devil, the malevolent power of the evil eye and in witches who channel evil," according to the study, which was published online Oct. 30 in the journal Proceedings of the Royal Society B.

"We uncovered consistent evidence that historical pathogen prevalence is related to an increased tendency to believe that there are forces of evil at work in the world," the researchers reported. Correlations between belief in the devil and historic, widespread disease were the strongest in Nigeria, Bangladesh and the Philippines; those correlations were the weakest in the Czech Republic, Germany and Sweden, the scientists found.

Viewing disease as evil would have promoted behavior that contained infection and limited outbreaks, benefiting the overall health of a community, the researchers said. Belief systems with a strong sense of good and evil as active forces thereby could have provided an advantage to groups of people living in areas of the world where the risk of contracting contagious diseases was high, the scientists added.

Once such convictions become embedded in a culture, their influence can linger for generations. Even today, when scientific explanations for disease are readily available, "such thinking remains evident in many modern societies, wherein health complaints are sometimes attributed to the will of God or the work of the devil and spiritual remedies persist," the authors wrote.

Originally published on Live Science.