Abstract Background Patients with mental illness experience higher rates of postoperative complications and mortality across several types of surgery, but knowledge is lacking in relation to cardiac implantable electronic device (CIED) implantations. Purpose Our study aimed to investigate the 7-day, 30-day, and 90-day postoperative complication rate and mortality in patients with severe mental illness compared to the general population. Methods All adult patients in Denmark with a first-time pacemaker or ICD implantation during the study period from July 1995 to December 2022 were identified using the Danish nationwide registers. Severe mental illness was defined as having a preexisting diagnosis of schizophrenia and other non-affective psychotic disorders, bipolar affective disorders or major depressive disorder. Postoperative complications were obtained as diagnosis codes possibly relating to device implantation and categorized into seven types of complications: arterial thrombosis, venous thrombosis, pneumothorax, bleeding, infection, device function problem, and death. Stratified logistic regression analyses adjusted for sex and age were used to calculate the odds of postoperative complications within 7, 30, and 90 days of device implantation. Results Among 108,790 patients who had a de novo pacemaker or ICD implantation the mean age was 73.5 (± 12.8), 37.5% were women and 3,393 (3.1%) of the patients had preexisting severe mental illness. In total, 10,690 (9.8%) patients had one or more complications within 90 days. The number of patients with severe mental illness who experienced a complication were 407 (12.0%) while it was 10,283 (9.8%) of those without severe mental illness. Odds of death (OR 1.57, 95% CI: 1.03-2.29) were higher in patients with severe mental illness 7 days postoperatively, and 30 days postoperatively odds of venous thromboembolism (OR: 1.69, 95% CI: 1.05-2.56) and death (OR: 1.62, 95% CI: 1.29-2.01) were higher in patients with severe mental illness. 90 days postoperatively odds of venous thrombosis (OR: 1.95, 95% CI: 1.37-2.70), infection (OR: 1.45, 95% CI: 1.16-1.79), and death (OR: 1.40, 95% CI: 1.19-1.65) were higher in patients with severe mental illness compared to patients without severe mental illness, while the odds of pneumothorax were lower at all three time points for patients with severe mental illness (OR 7-days: 0.49, 95% CI: 0.21-0.95). The odds of arterial thrombosis, bleeding and device function problems were similar between the two groups at all three time points. Conclusion Severe mental illness was associated with increased risk of several types of complications and death following CIED implantation. This indicates that further care and attention is needed to ensure adequate treatment of patients with severe mental illness suffering from cardiac arrhythmias.Forest plot, SMI: severe mental illness