Main

Obsessive–compulsive disorder (OCD) is a relatively common psychiatric disorder, with an estimated worldwide prevalence around 2% (refs. 1,2), associated with poor quality of life3, long-term functional impairment4,5, somatic morbidity6,7,8 and increased mortality risk9,10.

The causes of OCD can be broadly understood as a consequence of the complex interplay between genetic and environmental risk factors11,12. The specific genetic underpinnings of the disorder are only beginning to be unraveled, with evidence of substantial genetic correlations with other psychiatric disorders in general, and anorexia nervosa, Tourette syndrome and internalizing disorders in particular13,14. However, as the heritability of OCD is approximately 50% (refs. 12,15), it is of vital importance to identify environmental risk factors, particularly if they are modifiable16,17.

Currently, few environmental risk factors are considered to play a causal role in OCD, with the possible exception of perinatal complications18,19,20. Despite some early evidence indicating a potentially causal association21,22, the association between childhood infections and risk of incident OCD appears to be largely explained by shared familial factors23,24,25. Similarly, the association between bullying victimization and OCD also appears to be mostly explained by genetic confounding and therefore incompatible with a strong causal effect26.

Potentially traumatic life events, such as violent and sexual assaults, are pervasive across the world and known to be associated with a myriad of psychiatric manifestations27,28,29,30, but their causal link with the development of OCD specifically is unclear. Several systematic reviews have concluded that such an association is plausible, but the available evidence is currently insufficient to conclude that traumatic life events are on the causal pathway to OCD16,31. Most previous studies focused on obsessive–compulsive symptoms, rather than diagnoses, and relied on retrospective self-report16,31. Only a handful of studies have used longitudinal designs32,33. Even fewer studies have used genetically informative designs, and those that have, also relied on self-reported symptoms and cross-sectional data34,35. Controlling for familial factors is particularly important for causal inference because individuals with an increased genetic risk for OCD may also be more vulnerable to experience traumatic events (that is, evocative gene–environment correlations)36,37,38.

In this nationwide register-based study, we aimed to investigate the prospective association between potentially traumatic events objectively recorded in the Swedish registers and the short-term (that is, within 1 year of the recorded event) and long-term (that is, after 1 year) incidence of OCD in the general population. This is important because the year immediately following a traumatic event may represent a critical window of vulnerability during which OCD symptoms are more likely to emerge and be directly linked to the traumatic event. Analyses controlled for potential familial confounding through a sibling-controlled design. Finally, we also explored the specific contribution of genetic and environmental factors to the observed associations by conducting familial coaggregation analyses and applying quantitative genetic models in biological relatives with various degrees of genetic relatedness.

Results

Cohort characteristics

The characteristics of the main cohort are presented in Table 1. After excluding 137,415 individuals, the main cohort included 3,340,945 individuals (Fig. 1), of whom 1,624,248 (48.6%) were female and 1,716,697 (51.4%) were male. Among them, 107,717 had a record of assault/victimization and 435,264 had a record of a transport accident in the National Patient Register (NPR). The median (interquartile range) age at exposure was 20.8 (17.9–25.1) years for assault/victimization and 17.1 (12.6–23.7) years for transport accidents; 73,395 (68%) and 240,051 (55%) of exposed individuals were male, respectively.

Fig. 1: Flow chart of cohort selection.
Fig. 1: Flow chart of cohort selection.The alternative text for this image may have been generated using AI.
Full size image

Some individuals may have been excluded for more than one reason (for example, missing information on biological parents and emigrating before age six). From this cohort, we subsequently identified clusters of relatives for coaggregation and quantitative genetic modeling, which are presented separately in Supplementary Table 1.

Table 1 Distribution of study cohort characteristics

Associations between potentially traumatic events and incident OCD

Individuals exposed to assault/victimization had a 73% higher hazard of subsequently being diagnosed with OCD, compared with unexposed individuals (hazard ratio (HR) 1.73, 95% confidence interval (CI) 1.63–1.83) (Fig. 2). Specifically, the hazard was 131% higher during the first year following the assault/victimization (HR 2.31, 95% CI 1.98–2.70) and 67% higher thereafter (HR 1.67, 95% CI 1.57–1.77). A similar pattern was observed in the full sibling comparisons, although with attenuated estimates (Fig. 2). Exposed siblings had a 37% increase of being diagnosed with OCD, compared with their unexposed full siblings (HR 1.37, 95% CI 1.23–1.54), with the highest HR during the first year following assault/victimization (HR 1.86, 95% CI 1.37–2.51), followed by a lower HR thereafter (HR 1.31, 95% CI 1.16–1.48). The additional post-hoc analyses revealed a similar temporal pattern, with the risk of OCD peaking shortly after the victimization event—particularly between the second and third months—and gradually decreasing thereafter. Notably, an elevated risk remained detectable beyond 10 years following exposure. However, these post-hoc analyses were substantially underpowered relative to the main analysis, and most CIs overlapped (Supplementary Fig. 1).

Fig. 2: Cox regression analyses with time-varying exposure and age as the underlying time scale.
Fig. 2: Cox regression analyses with time-varying exposure and age as the underlying time scale.The alternative text for this image may have been generated using AI.
Full size image

Assault/victimization (a) and transport accidents (b). HRs and 95% CIs were estimated using Cox regression models. The color indicates the type of comparison: population (blue) and within full sibling (green). The shape indicates the follow-up period analyzed: whole follow-up period (circle), within the first year after the potentially traumatic event (triangle), and beyond 1 year after the potentially traumatic event (square). The cohort included 3,340,945 individuals for the population comparison, of which 2,452,871 had a full sibling included in the sibling comparison. Models were adjusted for birth year (categorized in 6-year increments) and sex.

By contrast, individuals exposed to transport accidents did not have an increased risk of being diagnosed with OCD compared with controls, either in the population (HR 0.98, 95% CI 0.94–1.01) or in the full sibling comparisons (HR 1.02, 95% CI 0.96–1.09) (Fig. 2).

Familial coaggregation analyses

Because transport accidents were not associated with increased OCD risk, these analyses focused exclusively on assault/victimization. Relatives of individuals exposed to assault/victimization had an increased risk of OCD, compared with relatives of unexposed individuals. Consistent with a shared familial effect, the association was strongest for full siblings and weakest for cousins (Fig. 3). To determine if familial coaggregation could be better explained by the direct effect of assault/victimization, we additionally adjusted for assault/victimization in the relatives. Similarly, to account for the possibility that results were influenced by co-occurrence of OCD in both proband and relative, we further adjusted for OCD in the proband. In both cases, the coaggregation patterns remained unchanged (Fig. 3).

Fig. 3: Familial coaggregation of assault/victimization and OCD.
Fig. 3: Familial coaggregation of assault/victimization and OCD.The alternative text for this image may have been generated using AI.
Full size image

ORs and 95% CIs were estimated using logistic regression models. In the population-wide, within-individual analysis, each participant contributed a single observation with information on exposure and outcome (3,340,945 individuals). In the cohorts of relatives, we identified pairs of relatives (each individual contributing at least once), with information on exposure and outcome. Individuals with more than one sibling or cousin may appear in multiple pairs within a cohort, and the same individual could also appear in different cohorts of relatives. The total number of observations included in the analysis for each cohort is presented in Supplementary Table 1. The within-individual analysis (black) was adjusted for sex and birth year (categorized in 6-year increments). Model 1 (blue) examines the risk of OCD for relatives of probands with assault/victimization, adjusted for the proband’s and relative’s sex and birth year (categorized in 6-year increments). Model 2 (red) is based on model 1, additionally adjusting for assault/victimization in the relatives. Model 3 (green) is based on model 1, additionally adjusting for OCD in the probands.

Quantitative genetic modeling

The phenotypic correlation between assault/victimization and OCD was 0.12 (95% CI 0.12–0.13) (Supplementary Table. 1). All intraclass correlations in maternal half siblings were approximately half of those observed in full siblings, and the highest cross-trait correlations were found among full siblings (Supplementary Table. 1). The AE submodel, including additive genetic (A) and unique environmental (E) components, provided the best fit (Supplementary Table. 2). The phenotypic correlation between assault/victimization and OCD was explained by additive genetic factors (69%; 95% CI 42–97) and nonshared environment (31%; 95% CI 3–58) (Fig. 4). However, the statistical power of these analyses was limited.

Fig. 4: Quantitative genetic modeling.
Fig. 4: Quantitative genetic modeling.The alternative text for this image may have been generated using AI.
Full size image

Best-fitting bivariate AE model for OCD and assault/victimization (a) and proportion of phenotypic correlation explained by A and E (b). The bar plot (b) shows the phenotypic correlation, with its 95% CI derived from the bivariate AE model. The color indicates the proportion of the phenotypic correlation explained by additive (orange) and unique environmental factors (blue). The analysis included a single randomly selected pair from each family in each cohort. The total number of observations included in the analysis is presented in Supplementary Table. 1.

Discussion

This population-based, genetically informative study prospectively examined the association between exposure to objectively recorded (that is, identified from nationwide administrative registers), potentially traumatic events and subsequent OCD diagnoses. Our results indicated that individuals exposed to assault/victimization, but not transport accidents, were at increased risk of being diagnosed with OCD. In addition, the association remained robust even after accounting for the shared environmental and genetic factors shared by full siblings, suggesting that the risk was at least partially independent from familial confounding. Nevertheless, our coaggregation and quantitative genetic modeling analyses suggest that a substantial portion of the observed association is attributable to genetic factors.

The findings substantially expand our understanding of the relationship between potentially traumatic events and OCD, highlighting the complexity of this association. Previous research had primarily relied on retrospective, cross-sectional and non-genetically informative designs, linking traumatic experiences (including physical and sexual abuse) with self-reported OCD symptoms32,33,34,35. The observed temporal pattern in the current study, with the risk of OCD highest in the first year following the traumatic event, is consistent with findings in other psychiatric disorders27,39. This pattern suggests that the first year may be particularly important for surveillance and early intervention in exposed individuals.

The observed associations were specific to assault/victimization, as we did not observe any meaningful associations with transport accidents. These categories differ meaningfully in that the first involves interpersonal trauma, characterized by intentional harm inflicted by another person, whereas the second typically reflects non-interpersonal or accidental trauma, lacking deliberate intent. This distinction is important, as interpersonal trauma is often associated with greater psychological impact, and may differentially influence the development of psychopathology, including OCD40.

Interestingly, the familial coaggregation and quantitative genetic modeling results suggested that the association between assault/victimization and OCD was largely attributable to shared genetic factors. One potential mechanism for such shared genetic influences is evocative gene–environment correlation, whereby genetically influenced traits associated with OCD, such as emotional dysregulation, may increase the likelihood of encountering high-risk situations, thereby elevating the risk of interpersonal violence36,37,38. We have recently reported that the association between self-reported bullying victimization and OCD may be largely explained by these mechanisms26. However, in the current study, the models also revealed a non-negligible contribution from unique environmental factors (around 30%), suggesting that assault/victimization may also be in the causal path of OCD, over and above genetic factors. Two previous genetic-informative studies, including within-twin comparisons, found that the association between self-reported interpersonal violence and obsessive–compulsive symptoms persisted in monozygotic twin comparisons34,35. These previous studies suggested that there may be a direct causal effect of such exposure on the risk of developing OCD even after strict adjustment of genetics and all environmental factors shared by monozygotic twins, which is consistent with our results.

Strengths and limitations

The strengths of our study include a nationwide study population, longitudinally and independently collected data on potentially traumatic events (minimizing selection and recall bias), the inclusion of sibling comparisons to control for familial confounding, and the high reliability of the International Classification of Diseases (ICD) diagnostic codes for OCD in Sweden41.

However, this study is not without limitations. First, individuals exposed to trauma may be more closely monitored for psychiatric disorders, particularly following the assault/victimization event. This increased surveillance could explain the higher observed risk shortly after exposure. Nevertheless, the association persisted even beyond the first year, suggesting that this potential bias cannot fully account for the observed association. Second, our analyses may not have captured milder forms of traumatic events, as exposures were defined on the basis of diagnoses recorded in inpatient and outpatient specialist care. Events for which individuals did not seek medical attention were therefore not included, either because they did not result in physical injuries requiring specialist care or for other reasons (for example, reluctance to disclose). In the Swedish healthcare context, victimization events are most likely to be detected and documented when they involve injuries treated in emergency units or other specialized care settings, rather than in primary care42. Finally, our quantitative genetic analyses had limited power, as reflected in the wide CIs of the estimates. Accordingly, the magnitude of the genetic and unique environmental contributions should be interpreted with caution. Nonetheless, our central conclusion, that both genetic and unique environmental factors contribute to the association, remains supported by the overall pattern of results, including consistent findings across several complementary analytical approaches.

Conclusion

Exposure to assault/victimization, but not transport accidents, was prospectively associated with an increased risk of incident OCD. These findings highlight a complex relationship between assault/victimization and OCD, involving both genetic vulnerability and individual environmental exposure.

Methods

The study was approved by the Swedish Ethical Review Authority (reference number 2020-06540). Because the study was register-based and individuals were not identifiable at any time, the requirement for informed consent was waived.

Data sources

We used the unique Swedish personal identification number43 to link several health and administrative registers. The Total Population Register44, which contains information on all Swedish inhabitants since 1968, was used to ascertain the study cohort and demographic data for the cohort members. The migration register44, which contains records on every immigration into and emigration out of Sweden, was used to obtain migration data. Data on deaths were retrieved from the Cause of Death Register45, which records the dates and causes of all deaths since 1961. Data on clinical diagnoses were obtained from the NPR46, which covers inpatient hospital admissions since 1969 and outpatient specialist care since 2001. Biological kinships were identified using the Multi-Generation Register, which contains information on individuals registered as residents in Sweden after 1960, and those born from 193247.

Study population

The main cohort included all individuals born in Sweden between 1975 and 2008 with complete information on both biological parents. We excluded individuals who died or emigrated before age 6. Within this cohort, we identified clusters of full siblings (that is, those sharing the same biological mother and father) and assigned them a family identification number. Individuals were followed up from birth until the date of OCD diagnosis, emigration, death or end of the follow-up (31 December 2020), whichever came first. For the coaggregation and quantitative genetic analysis, we used individuals from the main cohort as probands and identified proband-relative pairs to construct four subcohorts: full siblings, maternal half siblings (that is, siblings with the same mother but different father), paternal half siblings (that is, siblings with the same father but different mother) and cousins (that is, individuals that share two grandparents). All relatives were drawn from the main cohort and linked using family identification numbers. Ethnicity is not reported because Swedish national health and population registers do not collect this information for legal and ethical reasons.

Potentially traumatic events (exposures)

From the NPR, we identified records of two broad groups of potentially traumatic events: (1) assault/victimization (for example, assault with a blunt object, being pushed from a height, placed or pushed in front of moving objects, unarmed violence or sexual assault); and (2) transport accidents. See Supplementary Table 3 for the ICD codes corresponding to these exposures.

Incident OCD (outcome)

We identified the first instance of an OCD diagnosis in the NPR (ICD-8: 300.3; ICD-9: 300D; ICD-10: F42) if recorded after the age of 6 (to avoid misclassification of cases). The ICD codes for OCD in the NPR have shown moderate-to-excellent validity and excellent inter-rater reliability41.

Statistical analysis

We used Cox regression models with age as the underlying time scale and the first recorded potentially traumatic event (that is, assault/victimization or transport accident) as a time-varying exposure. Individuals were considered unexposed until the occurrence of their first recorded potentially traumatic event and exposed thereafter. For the full sibling comparisons, we fit stratified (conditional) Cox regression models comparing exposed full siblings with their unexposed counterparts with each family as a strata (that is, a discordant full sibling design). This approach inherently controls for confounding from all shared environmental factors and a substantial proportion (~50%) of genetic factors.

We assessed the risk of OCD: (a) for the whole follow-up period, (b) within the first year after the potentially traumatic event and (c) beyond 1 year after the potentially traumatic event. To further explore the temporal dynamics of the association, we conducted a post-hoc analysis using more granular follow-up intervals, ranging from the first month to more than 10 years after exposure. All models were adjusted for sex and birth year (categorized in 6-year increments). Robust standard errors were applied in all analyses to address familial clustering. The results are presented as HRs with 95% CIs.

Contribution of genetic and environmental factors

Because we expected a certain degree of effect attenuation in the full sibling models, potentially suggesting shared familial influences on the association between traumatic events and OCD, we analyzed the contribution of unique environmental and genetic influences to the observed associations using familial coaggregation analyses and quantitative genetic modeling. In the coaggregation analysis, we used logistic regression models to examine OCD risk in relatives of individuals exposed to potentially traumatic events, comparing it with risk in relatives of unexposed individuals (model 1). To determine whether familial coaggregation could be better explained by the direct effect of traumatic events, we additionally adjusted for potentially traumatic events in the relatives (model 2). To account for the possibility that results were influenced by co-occurrence of OCD in both proband and relative, we further adjusted for OCD in the proband (model 3). All three models were adjusted for sex and birth year (categorized in 6-year increments) of both the proband and the relative. Robust standard errors were used in all models to account for clustering within families. Estimates are presented as odds ratios (ORs) with 95% CIs.

For the quantitative genetic modeling, we randomly selected one pair of relatives from each family within each cluster (full siblings, half siblings and cousins) and calculated phenotypic, intratrait and cross-trait tetrachoric correlations. Using structural equation modeling, assuming a liability-threshold model, we decomposed variance and covariance into additive genetic (A), shared environmental (C) and nonshared environmental factors, including measurement errors (E). We used the standard assumption in sibling modeling studies, namely: (1) additive genetic factors correlate at 0.50 for full siblings, at 0.25 for half siblings and at 0.125 for cousins; (2) shared environmental factors fully correlate for full siblings and maternal half siblings, but do not correlate for paternal half siblings and cousins; and (3) nonshared environmental factors do not correlate for any siblings or cousins. We compared the full ACE model with the reduced submodels (AE and CE) using a weighted least-squares approach with 95% Wald CIs based on standard errors. The model with fewer parameters was considered the best fit if it was not significantly worse than the full model, based on the Akaike information criterion and the P value for the loss of fit. All models were adjusted for the sex of both individuals in a pair, as well as their birth year, with the latter modeled using linear and quadratic terms.

Analyses were conducted using SAS version 9.4 (SAS Institute Inc.) and the R packages Survival 3.5.5, drgee 1.1.10 and OpenMx 2.21.8. Data were analyzed from September 2024 to April 2025.

Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.