"Religion is a social institution that evolved as an integral mechanism of human culture to create and promote myths, to encourage altruism and reciprocal altruism, and to reveal the level of commitment to cooperate and reciprocate among members of a community. That is to say, religion evolved as the social structure that enforced the rules of human interactions before there were such institutions as the state or such concepts as laws and rights.
"We would do well to remember that the history of the modern nation-state with constitutional rights and protection of basic human freedoms can be measured in mere centuries, whereas human evolved as social primates over the course of millions of years, and human culture itself dates back at least 35,000 years, if not more.
"The principal social institution available to facilitate cooperation and goodwill was probably religion. An organized establishment with rules and morals, with a hierarchical structure so necessary for social primates, and with a higher power to enforce the rules and punish their transgressors, religion evolved as the penultimate effort of these pattern-seeking, storytelling, myth-making animals."
(Michael Shermer in "How we believe". page 162)