BACKGROUND : Evidence on the effectiveness of opioid agonist treatment (OAT) in reducing crime is mixed. We aimed to assess the effect of OAT on crime in terms of delaying time to first charge and reducing overall charge rates, as well as the relationship between OAT retention and overall charge rates. METHODS : We did a retrospective cohort study of opioid-dependent people who entered OAT for the first time between Jan 1, 2004, and Dec 30, 2010, in New South Wales (NSW), Australia. We used three linked NSW and national administrative datasets. Data on OAT were obtained from the Pharmaceutical Drugs of Addiction System, data on charges were obtained from the Reoffending Database, and data on mortality were obtained from the National Death Index. The cohort was followed up until Dec 31, 2011. Time-dependent OAT exposure was modelled using Cox proportional hazards models (time to first charge) and Andersen-Gill intensity models (total charge-days). Retention in OAT was modelled using two features of treatment engagement, number of OAT episodes and proportion of follow-up time in OAT (presented in quartile groupings: lowest, low-mid, low-high, highest) using zero-inflated negative binomial regression (total charges). All models were adjusted for sociodemographic, criminographic, and treatment-related variables. RESULTS : 10 744 new OAT entrants were included in the study. 5751 (53·5%) people were charged with an offence. In adjusted analyses, OAT was associated with an initial benefit in delaying the time to first charge (hazard ratio 0·43, 95% CI 0·33-0·55) and reducing total charge-days (0·39, 95% CI 0·30-0·52); however, these protective effects reduced over time. Total charge rates were higher as the number of OAT episodes increased (incident rate ratio [IRR] 1·13, 95% CI 1·11-1·15), and when relatively lower proportions of time were spent in OAT (IRR among the lowest three quartiles ranged from 1·11 [95% CI 1·02-1·21] to 1·22 [95% CI 1·12-1·33]). CONCLUSIONS : OAT was associated with a reduction in overall charge rates and was more protective as treatment engagement increased. Maximising treatment retention is crucial to achieving long-term health and social benefits of OAT. BACKGROUND : Australian National Health and Medical Research Council, Australian Institute of Criminology, National Institute on Drug Abuse, Australian Government Department of Health, UNSW Sydney.