Background/AimOpioid overdose deaths have increased in Sweden and other developed countries in recent decades, despite increased treatment efforts and harm-reduction interventions. Further knowledge in this field is needed if this trend is to be reversed. Previous research suggests that mental health and patterns of prescription of opioids and other prescription drugs are associated with increased opioid-related mortality. The present study therefore aimed to investigate what drugs were prescribed during the last six months of life to individuals with a history of illicit substance use who died with opioids present in their blood, the relationship between drugs prescribed and drugs found in blood at time of death, and if prescription of specific drugs was temporally associated with death.MethodsThis was a retrospective, register-based observational study that utilized data from the National Board of Forensic Medicine, the Prescribed Drug Registry, regional health care services, and municipal social services. We used conditional logistic regression to find temporal associations between the prescription and dispensing of drugs and time of death.ResultsPrescription and dispensing of alprazolam and diazepam were temporally associated with death. The most frequently dispensed drugs were zopiclone, pregabalin, methylphenidate, diazepam and oxycodone. Methadone, alprazolam, and buprenorphine were the drugs most often found in the blood. Opioids and tranquilizers in combination were found in a vast majority of deaths, and prescription data suggested that the use of these drugs was illicit in a majority of cases.ConclusionPrescription of certain drugs, especially alprazolam and diazepam, should be made with great caution to patients with a history of illicit substance use or concurrent use of opioids.