AIMS: This study investigates how age of opioid users is related to causes of death prior to, during and after opioid maintenance treatment (OMT), and estimates risks of death from various causes in relation to age. DESIGN, SETTING AND PARTICIPANTS: Data on all opiate dependents in Norway (1997-2003) who applied for and were accepted for OMT (n = 3789) were cross-linked with the Norwegian death register. The total observation time was 10 934 person-years. FINDINGS: A total of 213 deaths was recorded. Of these, 73% were subject to autopsy, and causes of death were known for 208 cases: the overall death rate was 1.9%. Deaths were due to drug overdose (54%), somatic (32%) and traumatic causes (14%). Overdose deaths among all age groups were reduced during OMT but age had a differential effect upon risk when out of treatment. Younger opioid users were at greater risk of overdose before entering treatment; older users were at greater risk after leaving treatment. Older OMT patients were at higher risk of both somatic and traumatic deaths, and deaths during OMT were most likely to be due to somatic causes. CONCLUSIONS: The high rates of overdose prior to and after treatment emphasize the need to provide rapid access to OMT, to retain patients in treatment and to re-enrol patients. The high prevalence among older patients of deaths due to somatic causes has implications for screening, treatment and referral, and may also lead to increased treatment costs.