As the number of patients who receive opioid prescriptions to treat non-cancer pain has increased in the past decade, so too have the number of overdoses. A new study, however, finds that states that legalized medical marijuana between 1999 and 2010 had 25% fewer annual overdose deaths than the rest of the U.S.

More specifically, the research, published in the Journal of the American Medical Association Internal Medicine, found that overdose deaths from opioids decreased by an average of 20% one year after the law's implementation, 25% by two years, and up to 33% by years five and six.

The study comes at a time when the CDC has warned that opioid overdoses are "skyrocketing." Since 1999, deaths from prescription painkillers have increased 400% among women and 265% among men.

The research team, lead by Dr. Marcus A. Bachhuber at the Philadelphia Veterans Affairs Medical Center, examined state medical marijuana laws and opioid overdose deaths using death certificate data.

California, Oregon, and Washington had medical marijuana laws effective before 1999. Alaska, Colorado, Hawaii, Maine, Michigan, Montana, Nevada, New Mexico, Rhode Island, and Vermont had medical marijuana laws effective between 1999 and 2010. Both of these groups of states were included in the research.

Nine states, including Massachusetts, enacted medical marijuana laws after the study concluded in 2010, so data from these states' recent legislation changes wasn't analyzed. As of July 2014, 23 states had enacted medical marijuana legislation, primarily to treat chronic or severe pain, but research has not yet been done to analyze whether these states had similar trends.

While safer treatment of chronic pain may help to explain lower rates of overdose deaths, the researchers suggest medical marijuana laws may also change the way people misuse or abuse opioid painkillers, as marijuana and opioids stimulate similar areas in the brain's pathways.

Bachhuber toldReuters that, "Most of the discussion on medical marijuana has been about its effect on individuals in terms of reducing pain or other symptoms. The unique contribution of our study is the finding that medical marijuana laws and policies may have a broader impact on public health."

Still, the researchers caution that their study doesn't yet prove a direct causal link: "If the relationship between medical cannabis laws and opioid analgesic overdose mortality is substantiated in further work, enactment of laws to allow for use of medical cannabis may be advocated as part of a comprehensive package of policies to reduce the population risk of opioid analgesics."