Regulators worldwide are reviewing safety data on glucagon-like peptide-1 receptor agonists (GLP-1RA), following reports by the Icelandic Medicines Agency in July 2023 of suicidal ideation and self-injury (SIS) in individuals taking liraglutide and semaglutide. We aimed to assess the risk of SIS in new users of GLP-1RA when compared with sodium-glucose cotransporter 2 inhibitors (SGLT-2i) users, prescribed to treat type 2 diabetes in individuals with obesity. This is a cohort study combining several population-wide databases and covering a Spanish population of five million inhabitants, including all adults with obesity who initiated treatment with either GLP-1RA or SGLT-2i for type 2 diabetes from 2015 to 2021. To estimate the comparative effect of GLP-1RA on the risk of SIS, we employed a new user, active comparator design and we carried out multivariable Cox regression modelling with inverse probability of treatment weighting (IPTW) based on propensity scores. We performed several stratified and sensitivity analyses. We included 3040 patients initiating treatment with GLP-1RA and 11,627 with SGLT-2i. When compared with patients treated with SGLT-2i, those in the GLP-1RA group were younger (55 vs 60 years old, p<0.001), had more anxiety (49.4% vs 41.5%, p<0.001), sleep disorders (43.2% vs 34.1%, p<0.001) and depression (24.4% vs 19.0%, p<0.001), and were more obese (35.1% of individuals with BMI ≥40 vs 15.1%, p<0.001). After propensity score weighting, standardised mean differences between groups were <0.1 for all covariates, showing adequate balance between groups at baseline after adjustment. In the main per-protocol analyses we found no evidence that GLP-1RA increased the incidence of SIS (HR 1.04; 95% CI 0.35, 3.14). Intention-to-treat analyses resulted in an HR of 1.36 (95% CI 0.51, 3.61). In analyses excluding individuals with no BMI information and using imputation for BMI missing values, respective HRs were 0.89 (95% CI 0.26, 3.14) and 1.29 (95% CI 0.42, 3.92). Stratified analyses showed no differences between subgroups. Our findings do not support an increased risk of SIS when taking GLP-1RA in individuals with type 2 diabetes and obesity; however, the rarity of SIS events and the wide uncertainty of effect size (although null, effect may be compatible with a risk as high as threefold) calls for a cautious interpretation of our results. Further studies, including final evaluations from regulatory bodies, are called for to discard a causal link between GLP-1RA and suicidality.