ABSTRACT: Importance:The hypothesis that disrupted immune function is implicated in the pathophysiology of psychiatric disorders and suicide is gaining traction, but the underlying mechanisms are largely unknown. Primary humoral immunodeficiencies (PIDs) are rare deficiencies of the immune system-mainly dysfunction of antibody production-and are associated with adverse health problems, such as recurrent infections and autoimmune diseases. Objective:To establish whether PIDs that affect antibody function and level are associated with lifetime psychiatric disorders and suicidal behavior and whether this association is explained by the co-occurrence of autoimmune diseases. Design, Setting, and Participants:This population- and sibling-based cohort study included more than 14 million individuals living in Sweden from January 1, 1973, through December 31, 2013. Register-based data on exposure, outcomes, and covariates were collected through December 31, 2013. Individuals with a record of PID were linked to their full siblings, and a family identification number was created. Data were analyzed from May 17, 2019, to February 21, 2020. Exposures:Lifetime records of PID and autoimmune disease. Main Outcomes and Measures:Lifetime records of 12 major psychiatric disorders and suicidal behavior, including suicide attempts and death by suicide. Results:A lifetime diagnosis of PID affecting immunoglobulin levels was identified in 8378 patients (4947 women [59.0%]; median age at first diagnosis, 47.8 [interquartile range, 23.8-63.4] years). A total of 4776 clusters of full siblings discordant for PID was identified. After adjusting for comorbid autoimmune diseases, PIDs were associated with greater odds of any psychiatric disorder (adjusted odds ratio [AOR],?1.91; 95% CI, 1.81-2.01) and any suicidal behavior (AOR,?1.84; 95% CI, 1.66-2.04). The associations were also significant for all individual psychiatric disorders (range of AORs, 1.34 [95% CI, 1.17-1.54] for schizophrenia and other psychotic disorders to 2.99 [95% CI, 2.42-3.70] for autism spectrum disorders), death by suicide (AOR, 1.84; 95% CI, 1.25-2.71), and suicide attempts (AOR, 1.84; 95% CI, 1.66-2.04). In the sibling comparisons, the associations were attenuated but remained significant for aggregated outcomes (AOR for any psychiatric disorder, 1.64 [95% CI, 1.48-1.83]; AOR for any suicidal behavior, 1.37 [95% CI, 1.14-1.66]), most individual disorders (range of AORs, 1.46 [95% CI, 1.23-1.73] for substance use disorders to 2.29 [95% CI, 1.43-3.66] for autism spectrum disorders), and suicide attempts (AOR, 1.41; 95% CI, 1.17-1.71). Joint exposure for PID and autoimmune disease resulted in the highest odds for any psychiatric disorder (AOR,?2.77; 95% CI, 2.52-3.05) and any suicidal behavior (AOR,?2.75; 95% CI, 2.32-3.27). The associations with psychiatric outcomes (AORs, 2.42 [95% CI, 2.24-2.63] vs 1.65 [95% CI, 1.48-1.84]) and suicidal behavior (AORs, 2.43 [95% CI, 2.09-2.82] vs 1.40 [95% CI, 1.12-1.76]) were significantly stronger for women than for men with PID. Conclusions and Relevance:Primary humoral immunodeficiencies were robustly associated with psychopathology and suicidal behavior, particularly in women. The associations could not be fully explained by co-occurring autoimmune diseases, suggesting that antibody dysfunction may play a role, although other mechanisms are possible. Individuals with both PID and autoimmune disease had the highest risk of psychiatric disorders and suicide, suggesting an additive effect. Future studies should explore the underlying mechanisms of these associations.