Background: Opioid agonist treatment (OAT) is effective but resource intensive to administer safely in custodial settings, leading to significant under-treatment of opioid dependence in these settings worldwide. Methods: This open-label trial compared depot buprenorphine, CAM2038 (weekly for 4 weeks then monthly) to oral methadone ( https://www.anzctr.org.au ACTRN12618000942257). Modelled treatment costs included a comparison group on sublingual buprenorphine-naloxone. Men and women, aged>18 years of various security classifications with a diagnosis of moderate to severe DSM-5 opioid use disorder and a custodial sentence of at least six months were recruited from correctional centres in New South Wales, Australia. Findings: Between November 2018 and July 2019, 67 patients not in OAT treatment at recruitment commenced depot buprenorphine. Sixty-two patients already stable on oral methadone treatment were recruited to the comparison arm. Patients treated with depot buprenorphine commonly reported at least one adverse event related to study drug (63/67, 94%), typically mild and transient. No diversion of depot buprenorphine was identified. Retention in depot buprenorphine treatment was 92%. Self-reported use of non-prescribed opioids (primarily buprenorphine-naloxone) and injecting drug use decreased significantly among depot buprenorphine patients by 16 weeks (p<0·0001). Monthly treatment costs were: $112AUD for injectable depot buprenorphine, $339AUD for oral methadone and $1,299AUD for sublingual buprenorphine-naloxone. Interpretation: The first published study to explore depot buprenorphine in custodial settings shows treatment retention, substance use and safety outcomes comparable to those observed in community settings and for other OAT used in custodial settings, without increased risk of diversion. Depot buprenorphine is a more efficient and less costly OAT delivery method requiring less health and custodial staff resources to administer. Enhanced access to depot buprenorphine should be considered for custodial settings worldwide. Trial Registration: (https://www.anzctr.org.au ACTRN12618000942257). Funding: NSW Health funded the study, and had input into design, data collection, analysis, interpretation and write-up. The JHFMHN provided clinical support for the study. Camurus AB provided CAM2038 for study participants with no right of veto of publication or dissemination of results. Declaration of Interests: AJD reports grants from Braeburn/Camurus AB, to conduct clinical studies with buprenorphine products and travel support to Hunter New England Local Health District, which employs AJD. He is an honorary investigator on an Indivior-funded study of buprenorphine products and has served on an advisory board for Mundipharma. PSH reports grants from Braeburn/Camurus AB, to conduct clinical studies with buprenorphine products and has served on advisory boards for Lundbeck, Indivior, AbbVie and Gilead. NL reports grants from Braeburn and Camurus AB to conduct sponsored, and investigator-led clinical studies with CAM2038. NL served on Advisory Boards for Mundipharma, Indivior and Chiesi Pharmaceuticals. MC was employed by the NSW Ministry of Health, sponsors of the study. All other authors declare no competing interests. Ethics Approval Statement: The trial was approved by JHFMHN and the Aboriginal Health and Medical Research Council (AHMRC) Human Research Ethics Committees (Protocol JH File No G561/17 & HREC/ 18/JH/3), as well as the CSNSW Ethics Committee. Participation was voluntary and written, informed consent was obtained from all participants prior to the conduct of any study procedure.