Repetitive thoughts followed by the compulsion to act on those thoughts are a mental illness.
Repeated hand washing, checking things, repeated mental images are seen commonly Patients are treated with cognitive Behavioral therapy, Psychotherapy medications at our clinic.