In this nation-wide cohort study we report the first long-term results of the association between having a atrial septal defects (ASD) on psychiatric disorders and use of psychotropic agents. Through population-based registries we included Danish individuals born before 1994 who received an ASD diagnosis between 1959and 2013. We used Cox proportional hazards regression and Fine and Grey competing risk regression to estimate the risk of receiving a psychiatric diagnosis and use of psychotropic medicine compared with a gender and age matched background population cohort. In 2,277 patients with a median follow-up from ASD diagnosis of 23.4 years (range 0.2 to 59.3 years) we found ASD patients to have a higher risk of psychiatric disorders (adjusted hazard ratio [HR]: 3.9; 95% confidence interval [CI] 3.4 to 4.5) compared with the comparison cohort and a cumulative incidence of using psychotropic agents 30 years after the ASD diagnosis of 47.4% (95% CI: 40.3 to 55.1) in the ASD patients and 25.5%, (95% CI: 23.5 to 27.8) in the comparison cohort. Diagnosis of the ASD before the age of 15 years (adjusted HR: 3.4; 95% confidence interval: 2.0 to 4.0) and surgical correction of the defect (HR: 1.5 (95% CI: 1.2 to 1.8), p <0.0001) had a higher risk than those with an ASD diagnosis after the age of 15 years and those with transcatheter closure of the defect. In conclusion, ASD patients had increased long-term risk of psychiatric disorder and use of psychotropic agents compared with a gender and age matched general population controls.