In American states where the use of medical marijuana is legal, the annual number of deaths from prescription-drug overdose is 25 percent lower than in states where medical marijuana is illegal, a new study suggests, adding fresh fuel to the debate over making cannabis more easily available to patients.

While medical marijuana laws can be controversial and many have raised concerns about their associated risks, they could also have unintended benefits, according to the study, which was published in the journal JAMA Internal Medicine on Monday. Wider availability of medical marijuana for people in pain might help to reduce the growing number of overdose deaths attributed to prescription pain pills, the study says.

“Prescription drug abuse and deaths due to overdose have emerged as national public health crises,” Colleen L. Barry, an associate professor at the Johns Hopkins Bloomberg School of Public Health and the study’s senior author, said in a statement. “As our awareness of the addiction and overdose risks associated with use of opioid painkillers such as Oxycontin and Vicodin grows, individuals with chronic pain and their medical providers may be opting to treat pain entirely or in part with medical marijuana, in states where this is legal.”

As part of the study, the researchers examined the implementation of state medical marijuana laws and opioid analgesic overdose deaths in the U.S. between 1999 and 2010. Three states -- California, Oregon and Washington -- legalized medical marijuana before 1999 while 10 states did so between 1999 and 2010. As of June 2014, another 10 states and Washington, D.C. too have adopted similar laws.

The researchers found that states that allow marijuana use for medicinal purposes had 24.8 percent fewer deaths from prescription-drug overdose compared to states that ban medical marijuana.

“In absolute terms, states with a medical marijuana law had about 1,700 fewer opioid painkiller overdose deaths in 2010 than would be expected based on trends before the laws were passed,” Marcus Bachhuber of the University of Pennsylvania and the study’s lead author, said in the statement.

Medical marijuana laws have been passed to give access to the drug to people suffering from severe pain, sometimes related to conditions such as cancer or multiple sclerosis. Cannabis is believed to have painkilling properties as well as the ability to relieve nausea and improve appetite.

“Given the fast pace of policy change, more research is critical to understand how medical marijuana laws might be influencing both overdose deaths and the health trajectories of individuals suffering from chronic pain,” Brendan Saloner, an assistant professor at Johns Hopkins Bloomberg School of Public Health and the study’s co-author, said, in the statement.