People living with psychosis experience excess premature mortality and are overrepresented in criminal legal systems, but little is known about mortality associated with criminal sanctions or diversion in this population. To examine associations of different types of recent (past 2 years) criminal sanction, including court diversion, with mortality among people with psychosis. This population-based, retrospective, data-linkage cohort study was conducted using 6 routinely collected administrative data collections from New South Wales, Australia, relating to health, court proceedings, imprisonment, and mortality. Participants (adults aged ≥18 years hospitalized for psychotic disorders) entered observation at the time of discharge from their first psychosis-related hospital admission (or their 18th birthday if aged <18 years) between July 2001 and November 2017 and were followed-up until May 2019. Data were analyzed between February 2023 and April 2024. Recent (past 2 years) criminal sanction type, a time-varying variable with 5 categories: no recent criminal sanction, recent mental health court diversion, recent community sanction, current imprisonment, and recent prior imprisonment (ie, recent prison release). Causes of death were described, and age- and sex-specific mortality rates by recent criminal sanction type were calculated. In those younger than 65 years, Cox regression was used to examine associations of all-cause and external-cause mortality with recent criminal sanction type, adjusting for sociodemographic, health-related, and offense-related confounders. The cohort included 83 071 persons (35 791 female [43.1%]; 21 208 aged 25-34 years [25.5%]; median [IQR] follow-up, 9.5 [4.8-14.2] years), of whom 25 824 (31.1%) received a criminal sanction. There were 11 355 deaths. In those aged younger than 65 years, recent mental health court diversion, community sanctions, and prior imprisonment were associated with increased hazards of all-cause and external-cause mortality compared with no recent sanction, with the largest adjusted hazard ratios (aHRs) observed for recent prior imprisonment (all-cause mortality: aHR, 1.69; 95% CI, 1.50-1.91; external-cause mortality: aHR, 2.64; 95% CI, 2.27-3.06). In this cohort study of people with psychosis, recent criminal sanctions were associated with increased mortality irrespective of sanction type. These findings suggest that future research should develop strategies to improve health and safety in people with psychosis who have criminal legal system contact.