To compare the risk for all cause and overdose mortality in people with opioid dependence during and after substitution treatment with methadone or buprenorphine and to characterise trends in risk of mortality after initiation and cessation of treatment.