An essential element in the diagnosis of obsessive compulsive disorder (OCD) is the presence of unwanted, intrusive thoughts (obsessions) which induce significant anxiety symptoms. The anxiety then prompts you to engage in repetitive, ritualistic behaviors (compulsions) which serve to reduce your anxiety over the short term. So the diagnosis of OCD requires the presence of both obsessions and compensatory compulsions.
But the problem with the compulsions is that the reduction in the anxiety does not last long, and when another situation comes along, you resort to your obsessions and this again induces anxiety which compels you to act and engage in compulsive behaviors.
The good news is that you can break this vicious, negative cycle of OCD. Please watch the following video on how OCD develops, and how you can treat it: