In the U.S., 23 states and the District of Columbia allow their residents to legally use medical marijuana. And, according to a new study, death certificates reveal that states with a medical marijuana law have lower rates of deaths caused by narcotic painkiller overdoses than other states.

Only California, Oregon and Washington had laws effective prior to 1999, the point when the researchers began their analysis. Ten other states put laws on their books between 1999 and 2010. The researchers analyzed each state in the years after a medical cannabis law came into effect.

Overall, the states with these laws had a nearly 25 percent reduction in opioid overdose deaths. The study was published this week in JAMA Internal Medicine.

The findings could help address the nation’s growing problem with opioid overdoses—about 60 percent of deaths are people who have prescriptions for the medication. However, the study authors caution that their analysis doesn’t account for health attitudes in different states that might explain the association. They did explore whether policies addressing painkiller abuse had any effect on the decline in deaths and didn’t find a link.

Previous studies hint at why marijuana use might help reduce reliance on opioid painkillers. Many drugs with abuse potential such as nicotine and opiates, as well as marijuana, pump up the brain’s dopamine levels, which can induce feelings of euphoria. The biological reasons that people might use marijuana instead of opioids aren’t exactly clear, because marijuana doesn’t replace the pain relief of opiates. However, it does seem to distract from the pain by making it less bothersome.