As the opioid crisis deepens in many places across the country, an increasing number of researchers and advocates are looking at legal marijuana as a possible solution. But a new study suggests that the connection between the two is more complicated than previously understood.

The study, which was published online this month by the Journal of Health Economics, makes two significant findings.

First, it confirms the results of a groundbreaking 2014 study that found states with medical marijuana laws have lower rates of fatal opioid overdoses. The connection was most dramatic, the new study concludes, in states that allowed dispensaries. For cannabis advocates, that is a major result because it provides further evidence that, when given the option, people may choose to treat pain with marijuana instead of with highly addictive opioids.

But the study’s second finding adds a complicating layer to the debate.

As more and more states adopted medical marijuana laws, those laws’ link to a reduction in opioid overdoses appeared to diminish, according to the study. When researchers included data after 2010 in their analysis, they found that the effectiveness of having any medical marijuana law “completely disappears.” While states that allowed dispensaries continued to see a connection to lower fatal overdose rates, researchers wrote that, “the magnitude of even this component of the policy has changed[.]”

“This is a sign that medical marijuana, by itself, will not be the solution to the nation’s opioid crisis today,” Rosalie Pacula, one of the study’s authors, said in a statement.

Related: Can marijuana help ease the opioid epidemic? New UCLA cannabis research center aims to find out

So what’s going on? David Powell, the paper’s lead author, said researchers have a couple of theories.

For one, he said, the opioid crisis is changing. As doctors pull back on the number of opioid painkillers they prescribe, people addicted to the drugs have shifted to heroin or synthetics bought illicitly. Those drugs come with both high potency and high risk of overdose, and marijuana may be less effective as a substitute, he said.

But another possibility, he said, is that medical marijuana laws changed as they aged. Pre-2010, when Colorado was one of the only states in the country with dispensaries, medical marijuana rolls swelled and dispensaries operated with little oversight.

After 2010, though, Powell said states including Colorado began more tightly regulating dispensaries. And that tighter control — a key requirement for states to meet Obama administration-era policies that kept federal enforcement at bay — may have limited access enough to shrink the impact on opioid overdoses.

“There’s kind of no way to really test this well, so we’re hypothesizing on this,” Powell said.

Powell and Pacula both work for the RAND Corporation, and another researcher on the paper, Mireille Jacobson, works at the University of California Irvine. Their research was supported by a federal grant.

The paper’s timeline for analysis stops at 2013, before Colorado and other states began allowing sales of marijuana to anyone over 21 for any purpose. That should have, in theory, opened marijuana access back up to a much wider population, Powell said. And, a study last year using preliminary data found that Colorado experienced a “reversal” in opioid overdoses after legal sales began.

But Powell said deeper study on full legalization’s impact is needed.

“We’re hesitant to extrapolate that far,” he said. “I think that needs its own analysis.”