Background Depression is the most common comorbidity in obsessive-compulsive disorder (OCD). However, the mechanisms of depressive comorbidity in OCD are poorly understood. We assessed the directionality and moderators of the OCD-depression association over time in a large, prospective clinical sample of OCD patients. Methods Data were drawn from 382 OCD patients participating at the Netherlands Obsessive-Compulsive Disorder Association (NOCDA) study. Cross-lagged, structural equation modeling analyses were used to assess the temporal association between OCD and depressive symptoms. Assessments were conducted at baseline, two-year and four-year follow up. Cognitive and interpersonal moderators of the prospective association between OCD and depressive symptoms were tested. Results Cross-lagged analyses demonstrated that OCD predicts depressive symptoms at two-year follow up and not vice a versa. This relationship disappeared at four-year follow up. Secure attachment style moderated the prospective association between OCD and depression. Conclusions Depressive comorbidity in OCD might constitute a functional consequence of the incapacitating OCD symptoms. Both OCD and depression symptoms demonstrated strong stability effects between two-year and four-year follow up, which may explain the lack of association between them in that period. Among OCD patients, secure attachment represents a buffer against future depressive symptoms.