Abstract Aims Atrial fibrillation (AF) is a growing public health concern, but its aetiology is not well understood. A few studies investigated the association of depression and anxiety with AF and yielded mixed results. Studies analysing the link of other psychiatric disorders (PDs) with AF risk are scarce. Herein, we investigated the association between a broad range of PDs and the risk of incident AF. Methods and results We studied 3 815 546 parents of live-born children registered in the Swedish Medical Birth Register during 1973–2014 and followed them from 1 January 2001 to 31 December 2023. We used Cox proportional hazard models and flexible parametric survival models to estimate the associations of overall and 14 specific PD subtypes with the risk of incident AF. We used sibling comparisons to evaluate whether shared familial factors confounded the observed associations. Altogether 806 078 (21.13%) participants had at least one PD and 213 048 (5.58%) had a diagnosis of AF during the 82.6 million person-years follow-up. Overall PD and several types of PDs were associated with increased risks of AF. The adjusted hazard ratios and 95% confidence intervals for AF according to overall PD were 1.28 (1.27–1.29) and 1.32 (1.29–1.35) in the whole cohort and in the sibling analysis, respectively. The associations were generally strongest early in the follow-up, progressively weakened over time, but persisted through the whole follow-up. Conclusion Several PDs were linked to increased risks of developing AF. Further studies are needed to replicate our findings and to understand the mechanisms underlying these associations.