Many people who abuse drugs or alcohol are self-medicating chronic pain, a new study suggests. Researchers at Boston University studied 589 people who fit the criteria for drug abuse or illicit drug use, and found 87 percent reported chronic pain.

Of the 576 patients who used illicit drugs (marijuana, cocaine and/or heroin), 51 percent reported using drugs to treat pain. The study found 81 percent of the 121 people who said they misused prescription opioid painkillers reported they did so to treat their pain.

Of the 265 patients who reported any amount of heavy drinking in the past three months, 38 percent said they were self-medicating chronic pain. The researchers found 79 percent of patients determined to be high-risk drinkers were self-medicating, according to Medical Daily.

The results appear in the Journal of General Internal Medicine.

“While the association between chronic pain and drug addiction has been observed in prior studies, this study goes one step further to quantify how many of these patients are using these substances specifically to treat chronic pain,” lead author Dr. Daniel Alford said in a news release. “It also measures the prevalence of chronic pain in patients who screen positive for illegal drug use and prescription drug abuse.”

Alford added, “Pain should be treated as part of the long-term strategy for recovery. If drugs are being used to self-medicate pain, patients may be reluctant to decrease, stop, or remain abstinent if their pain symptoms are not adequately managed with other treatments including non-medication-based treatments.”