This chapter outlines an evolutionary scenario for the emergence of religion. From cognitive science, four mental prerequisites of religious cognition are discussed: (1) hyperactive agency detection, (2) theory of mind, (3) imagination, and (4) altered states of consciousness. Evidence for these prerequisites in nonhuman primates suggests their presence in our early hominin ancestors. From comparative psychology, evidence of ritual behavior in nonhuman primates and other species is reviewed. Archeological evidence of ritual behavior is also discussed. Collectively, these data indicate that the first step toward religion was an elaboration of primate social rituals to include group synchronized activities such as dancing, chanting, and singing. Control of fire, pigment use, and increasing brain size would have intensified group synchronized rituals over time, which, in the context of increased intergroup interactions, eventually led to the first evidence of supernatural ritual at about 70,000 years before present.