SummaryBackgroundPeople with severe mental illness have a mortality rate higher than the general population, living an average of 10–20 years less. Most studies of mortality among people with severe mental illness have occurred in high-income countries (HICs). We aimed to estimate all-cause and cause-specific relative risk (RR) and excess mortality rate (EMR) in a nationwide cohort of inpatients with severe mental illness compared with inpatients without severe mental illness in a middle income country, Brazil.MethodsThis national retrospective cohort study included all patients hospitalised through the Brazilian Public Health System (Sistema Único de Saúde [SUS]-Brazil) between Jan 1, 2000, and April 21, 2015. Probabilistic and deterministic record linkages integrated data from the Hospital Information System (Sistema de informações Hospitalares) and the National Mortality System (Sistema de Informação sobre Mortalidade). Follow-up duration was measured from the date of the patients’ first hospitalisation until their death, or until April 21, 2015. Severe mental illness was defined as schizophrenia, bipolar disorder, or depressive disorder by ICD-10 codes used for the admission. RR and EMR were calculated with 95% CIs, comparing mortality among patients with severe mental illness with those with other diagnoses for patients aged 15 years and older. We redistributed deaths using the Global Burden of Diseases, Injuries, and Risk Factors Study methodology if ill-defined causes of death were stated as an underlying cause.FindingsFrom Jan 1, 2000, to April 21, 2015, 72 021 918 patients (31 510 035 [43·8%] recorded as male and 40 974 426 [56·9%] recorded as female; mean age 41·1 (SD 23·8) years) were admitted to hospital, with 749 720 patients (372 458 [49·7%] recorded as male and 378 670 [50·5%] as female) with severe mental illness. 5 102 055 patient deaths (2 862 383 [56·1%] recorded as male and 2 314 781 [45·4%] as female) and 67 485 deaths in patients with severe mental illness (39 099 [57·9%] recorded as male and 28 534 [42·3%] as female) were registered. The RR for all-cause mortality in patients with severe mental illness was 1·27 (95% CI 1·27–1·28) and the EMR was 2·52 (2·44–2·61) compared with non-psychiatric inpatients during the follow-up period. The all-cause RR was higher for females and for younger age groups; however, EMR was higher in those aged 30–59 years. The RR and EMR varied across the leading causes of death, sex, and age groups. We identified injuries (suicide, interpersonal violence, and road injuries) and cardiovascular disease (ischaemic heart disease) as having the highest EMR among those with severe mental illness. Data on ethnicity were not available.InterpretationIn contrast to studies from HICs, inpatients with severe mental illness in Brazil had high RR for idiopathic epilepsy, tuberculosis, HIV, and acute hepatitis, and no significant difference in mortality from cancer compared with inpatients without severe mental illness. These identified causes should be addressed as a priority to maximise mortality prevention among people with severe mental illness, especially in a middle-income country like Brazil that has low investment in mental health.FundingBill and Melinda Gates Foundation, Fundação de Amparo a Pesquisa do Estado de Minas Gerais, FAPEMIG, and the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior—Brasil.