Lancet flukes (Dicrocelium dendriticum) are a clever little parasite. To reproduce, they find their way into the stomach of a sheep or cow by commandeering an ant’s brain. Once this happens, ants exhibit strange behavior: they climb up the nearest blade of grass until it falls, then they climb it again, and again. If the flukes are lucky, a grazing farm animal eats the grass along with the ant; a sure win for the flukes, but a sad, and unfortunate loss for the six-legged insect.

Does anything like this happen with human beings? Daniel Dennett thinks so. In the beginning of his book Breaking the Spell, Dennett uses the fluke to suggest that religions survive because they influence their hosts (e.g., people) to do bad things for themselves (e.g., suicide bombing) but good things for the parasite (e.g., Islam). Implicit in Dennett’s example is that religions are like viruses, and people and societies are better of without them.

Dennett’s position is akin to the rest of the New Atheists: religion is a nasty and irrational byproduct of natural selection. This means that religious beliefs were not directly selected for by evolution any more than our noses evolved to help us keep our glasses from sliding off our faces. In the words of Pascal Boyer, “religious concepts and activities hijack our cognitive resources.” The question is: what cognitive resources influenced religion?

Most cognitive scientists agree that the Hypersensitve Agency Detection Device (abbreviated HADD) played an important role. In brief, the HADD explains why we see faces in the clouds, but never clouds in faces. Neuroscientist Dean Buonomano puts it this way: “We are inherently comfortable assigning a mind to other entities. Whether the other entity is your brother, a cat, or a malfunctioning computer, we are not averse to engaging it in conversation.” This ability endows will and intention to other people, animals and inanimate objects. The HADD produces a lot of false positive errors (e.g., seeing the virgin Mary in a piece of toast), and God might be one of them.

Another feature of the human mind that religion might have co-opted is a natural propensity towards a dualistic theory of mind. Dualism is our tendency to believe that people are made up off physical matter (e.g., lungs, DNA, and atoms) as well as an underlying and internal essence. Even the strictest materialist cannot escape this sentiment; we all feel that there is a “me” resting somewhere in our cortices. A belief in disembodied spirits could have given rise to beliefs in supernatural entities that existed independent of matter. Yale psychologist Paul Bloom is a proponent of this view and supports his conclusions with experimental evidence highlighted in his book Descartes’ Baby.

Although the by-productive hypothesis, as it is known, is incomplete, it all points to the same logic: “a bit of mental machinery evolved because it conferred a real benefit, but the machinery sometimes misfires, producing accidental cognitive effects that make people prone to believing in gods.”

This is an important piece of the puzzle for the New Atheists. If religion is the off shoot of a diverse set of cognitive modules that evolved for a variety of problems, then religious beliefs are nothing more than a series of neural misfires that are “correctable” with secular Enlightenment thinking.

Not everyone agrees. The evolutionary biologists David Sloan Wilson and Edward O. Wilson propose that religiosity is a biological adaptation that created communities by instilling a “one for all, all for one” mentality in its members. This is important because it allowed group members to function as a superorganism, which moreover gave them an advantage on the African savannah; “An unshakable sense of unity among… warriors,” Buonomano says, “along with certainty that the spirits are on their side, and assured eternity, were as likely to, as they are now, to improve the chances of victory in battle.” The binding power of religion would have also helped communities form objective moral codes – do unto others as you would have others do unto you – and protected against free riders.

Jonathan Haidt is making a name for himself by advocating this point. In addition to the group selection hypothesis, Haidt points to our species ability to experience moments of self-transcendence. The world’s religions, he believes, are successful because they found a way to facilitate such experiences. Here’s how he explained it in a recent TED:

If the human capacity for self-transcendence is an evolutionary adaptation, then the implications are profound. It suggests that religiosity may be a deep part of human nature. I don’t mean that we evolved to join gigantic organized religions — that kind of religion came along too recently. I mean that we evolved to see sacredness all around us and to join with others into teams that circle around sacred objects, people and ideas. This is why politics is so tribal. Politics is partly profane, it’s partly about self-interest. But politics is also about sacredness. It’s about joining with others to pursue moral ideals. It’s about the eternal struggle between good and evil, and we all believe we’re on the side of the good.

What’s interesting about Haidt’s angle is that it sheds a bad light on Enlightenment and secular ideals that western civilization was founded on. We exult liberty, individualism and the right to pursue our self-interest. But are we ignoring our innate desire to be part of something greater? Are we denying our groupish mentalities? The modern world gives us fixes – think big football games or raves – but I think some atheists are deprived.

And this brings me back to the fluke and the New Atheists. If Haidt is right, and our religiosity was an evolutionary adaptation, then religious beliefs are a feature of, not a poison to, our cognition. The fluke, therefore, is not a parasite but an evolutionary blessing the facilitated the creation of communities and societies. This is not to deny all the bloodshed on behalf of religion. But if religion is an adaptation and not a byproduct, then “we cannot expect people to abandon [it] so easily.”