...the evolutionary perspective on religion does not necessarily threaten the central position of either side. That religious behavior was favored by natural selection neither proves nor disproves the existence of gods. For believers, if one accepts that evolution has shaped the human body, why not the mind too? What evolution has done is to endow people with a genetic predisposition to learn the religion of their community, just as they are predisposed to learn its language. With both religion and language, it is culture, not genetics, that then supplies the content of what is learned.
It is easier to see from hunter-gatherer societies how religion may have conferred compelling advantages in the struggle for survival. Their rituals emphasize not theology but intense communal dancing that may last through the night. The sustained rhythmic movement induces strong feelings of exaltation and emotional commitment to the group. Rituals also resolve quarrels and patch up the social fabric.
The ancestral human population of 50,000 years ago, to judge from living hunter-gatherers, would have lived in small, egalitarian groups without chiefs or headmen. Religion served them as an invisible government. It bound people together, committing them to put their community’s needs ahead of their own self-interest. For fear of divine punishment, people followed rules of self-restraint toward members of the community. Religion also emboldened them to give their lives in battle against outsiders. Groups fortified by religious belief would have prevailed over those that lacked it, and genes that prompted the mind toward ritual would eventually have become universal. Nicholas Wade, "The Evolution of the God Gene"