OBJECTIVES: The aim of this study was to examine the effect of schizophrenia or schizoaffective disorder on the risk of developing subsequent type 1 (T1)- or type 2 (T2) diabetes mellitus (DM), by carrying out a Swedish register study. MATERIAL & METHODS: Data from the Total Population- and Medical Birth- Registers were used to create a cohort of all individuals born in Sweden 1987-2004. The cohort individuals were linked with the Inpatient- and Outpatient-Registers and followed from birth to 2018 to identify onset of schizophrenia, schizoaffective disorder and DM. Cox proportional hazard models were applied to assess the associations between schizophrenia or schizoaffective disorder and risk for T1DM or T2DM during a follow-up from age 13. RESULTS: The study population included 1 736 281 individuals and the length of follow-up was maximally 19.0 (median 10.6) years. The risk of developing T1DM was significantly higher among individuals with, than without, schizophrenia [adjusted hazard ratio (HR) (95% confidence interval (CI)): 2.84 (1.18-6.82), p=0.0195], whereas among individuals with or without schizoaffective disorder, the risk of developing T1DM did not differ [adjusted HR (95% CI): 1.23 (0.17-8.74), p=0.8377]. The risk of developing T2DM was significantly higher both among individuals with schizophrenia and schizoaffective disorder, than among those without such diagnoses [adjusted HR (95% CI): 13.98 (8.70-22.46), pCONCLUSIONS: This study shows that schizophrenia is associated with increased risk for subsequent T1DM. It also shows that both schizophrenia and schizoaffective disorder are associated with increased risk for subsequent T2DM.