Introduction: Whether infection with SARS-CoV-2 leads to excess risk of requiring hospitalization or intensive care in persons with diabetes has not been reported, nor have risk factors in diabetes associated with increased risk for these outcomes. Methods: We included 44,639 and 411,976 adult patients with type 1 and type 2 diabetes alive on Jan 1, 2020, and compared them to controls matched for age, sex, and county of residence (n=204,919 and 1,948,900). Standardized rates of hospitalizations, admissions to intensive care and death were estimated and hazard ratios were calculated using Cox regression analyses. Findings: There were 10,486 hospitalizations and 1,416 admissions into intensive care. A total of 1,175 patients with diabetes and 1,820 matched controls died from COVID-19, of these 53·2% had been hospitalized and 10·7% had been in intensive care. Patients with type 2 diabetes, compared to controls, displayed a hazard ratio (HR) of 2·22, 95%CI 2·13-2·32) of being hospitalized, which decreased to HR 1·40, 95%CI 1·34-1·47) after adjustment for sociodemographic factors, pharmacological treatment and comorbidities, had higher risk for admission to intensive care (HR 2·49, 95%CI 2·22-2·79, decreasing to 1·42, 95%CI 1·25-1·62 after adjustment, and increased risk for death (HR 2·19, 95%CI 2·03-2·36, adjusted 1·50, 95%CI 1·39-1·63). HR for hospitalization for type 1 diabetes was 2·10, 95%CI 1·72-2·57), decreasing to 1·25, 95%CI 0·3097-1·62) after adjustment· Patients with diabetes type 1 were twice as likely to require intensive care for COVID-19, however, not after adjustment (HR 1·49, 95%CI 0·75-2·92), and more likely to die (HR 2·90, 95% CI 1·6554-5·47), but not independently of other factors (HR 1·38, 95% CI 0·64-2·99). Among people with diabetes, elevated glycated hemoglobin levels were associated with higher risk for most outcomes. Interpretation: In this nationwide study, type 2 diabetes was independently associated with increased risk of hospitalization, admission to intensive care and death for COVID-19, whereas type 1 diabetes was not independently associated with excess risk for any outcome. Funding Statement: This work was supported by grants from: the Swedish state under an agreement concerning research and education of doctors [ALFGBG-717211]; the Swedish Heart and Lung Foundation [2018- 0366]; the Swedish Research Council [2013-05187, VRREG 2019-00193, 2020-05792] Declaration of Interests: Professor Eliasson reports personal fees (expert panels, lectures) from Amgen, AstraZeneca, Boehringer Ingelheim, Eli Lilly, Merck Sharp & Dohme, Mundipharma, Navamedic, NovoNordisk, RLS Global, grants and personal fees from Sanofi, all outside the submitted work. NN declare that they have no conflict of interest. MG reports personal fees (scientific advisory boards, lectures) from Gilead Sciences, GSK/ViiV, MSD, Biogen, Amgen, Novocure, Novo Nordic and research grants from Gilead Sciences, all outside the submitted work. All other authors have nothing to disclose. Ethics Approval Statement: The Swedish Ethical Review Authority approved the study.