Obsessive-Compulsive Disorder is diagnosed when someone has repeated thoughts, images or impulses, or feels compelled to do certain behaviours over and over, to the point where these interfere with their well being and normal routines and functioning.
Compulsions are often performed in the belief that if the person does them they will prevent something bad happening. The person usually recognises that the obsessions and compulsions are unreasonable.