We humans have many varieties of religious experience. One of the most common is self-transcendence — a feeling becoming part of something larger, grander and nobler. Most people experience this at least a few times in their lives. When the self thins out and melts away, it not only feels good but can be thrilling.

It’s as though our minds contain a secret staircase taking us from an ordinary life up to something sacred and deeply interconnected, and the door to that staircase opens only on rare occasions. The world’s many religions have found a variety of ways to help people find and climb the staircase. Some religions employ meditation. Others use spinning, dancing and repetitive movements in combination with music. Some use natural drugs. Many secular people have used these methods too — think of the popularity of rave parties, which combine most of these techniques to produce feelings of “peace, love, unity and respect.” As the great French sociologist Emile Durkheim put it, we are “homo duplex,” or a two-level man.

The big question is, Why do our minds contain such a staircase? I believe it’s because there was a long period in human evolution during which it was adaptive to lose the self and merge with others. It wasn’t adaptive for individuals to do so, but it was adaptive for groups. As evolutionary biologists David Sloan Wilson and Edward O. Wilson have proposed, religiosity is a biological adaptation for binding groups together and helping them enter a mind-set of “one for all, all for one.” Groups that developed emotionally intense, binding religions were able, in the long run, to outcompete and outlast groups that were not so tightly bound.

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.

Most social scientists have assumed that religion is not an adaptation. They try to explain the rise of civilization using ideas about kinship (we can be nice to those who share our genes) and reciprocity (we can be nice to those who might return the favor some day). Cooperation with strangers that we’ll never see again is assumed to be an evolutionary “mistake.” But if you see religion as an adaptation that helps groups compete, then religions make a lot more sense.

This perspective also helps explains the persistent undercurrent of dissatisfaction in modern life. Ever since the Enlightenment, modern secular society has emphasized liberty and self-expression. We exult in our freedom, but sometimes we wonder: Is this all there is? What should I do with my life? What’s missing? What’s missing is that we are homo duplex, but only our first-floor, profane longings are being satisfied.

One great challenge of modern life is to find the staircase then to do something good and noble once you climb to the top. I see this desire in my students at the University of Virginia. They all want to find a cause or calling that they can throw themselves into. They’re all searching for their staircase. Most people long to become part of something larger. And this explains the extraordinary resonance of this simple metaphor conjured up nearly 400 years ago. “No man is an island entire of itself. Every man is a piece of the continent, a part of the main.”

This essay is adapted from the conclusion of a talk that Haidt gave at TED 2012.