Ritualized behavior, intuitively recognizable by its stereotypy, rigidity, repetition, and apparent lack of rational motivation, is found in a variety of life conditions, customs, and everyday practices: in cultural rituals, whether religious or non-religious; in many children's complicated routines; in the pathology of obsessive-compulsive disorders (OCD); in normal adults around certain stages of the life-cycle, birthing in particular. Combining evidence from evolutionary anthropology, neuropsychology and neuroimaging, we propose an explanation of ritualized behavior in terms of an evolved Precaution System geared to the detection of and reaction to inferred threats to fitness. This system, distinct from fear-systems geared to respond to manifest danger, includes a repertoire of clues for potential danger as well as a repertoire of species-typical precautions. In OCD pathology, this system does not supply a negative feedback to the appraisal of potential threats, resulting in doubts about the proper performance of precautions, and repetition of action. Also, anxiety levels focus the attention on low-level gestural units of behavior rather than on the goal-related higher-level units normally used in parsing the action-flow. Normally automatized actions are submitted to cognitive control. This swamps working memory, an effect of which is a temporary relief from intrusions but also their long-term strengthening. Normal activation of this Precaution System explains intrusions and ritual behaviors in normal adults. Gradual calibration of the system occurs through childhood rituals. Cultural mimicry of this system's normal input makes cultural rituals attention-grabbing and compelling. A number of empirical predictions follow from this synthetic model.