Two controversial issues have merged into one as a new ruling states that people who use marijuana — including for medical purposes — are prohibited from buying guns because of the link between pot use and gun violence.

A ruling from the US 9th Circuit Court of Appeals says that illegal drug users, which include cannabis users, cannot legally own a firearm, even in states where medical and recreational marijuana is legal, the Pacific Standard reports. The federal appeal court adds that banning gun sales among drug users is not a violation of the Second Amendment.

The Second Amendment prohibits felons and individuals with mental illnesses from buying firearms, along with illegal drug users and addicts.

The ruling covers nine Western states under the court’s jurisdiction: Alaska, Arizona, California, Hawaii, Idaho, Montana, Nevada, Oregon, and Washington. Medical marijuana use is legal in California, Hawaii, Montana, and Nevada. Recreational as well as medical pot is legal in Alaska, Oregon, and Washington.

But since cannabis is classified as a Schedule I substance, which means it is not accepted for medical use under federal law, it falls under the ruling’s parameters.

According to Senior District Judge Jed Rakoff, who authored the court’s opinion on the ruling, marijuana users are likely “to experience altered or impaired mental states that affect their judgment and that can lead to irrational or unpredictable behavior.” This, he says, is “beyond dispute.”

The ruling passed down Wednesday upholds recommendations given by the Bureau of Alcohol, Tobacco, Firearms, and Explosives (ATF). The ATF announced in 2011 that in states where medical marijuana is legal, anyone who uses cannabis and possesses a gun is in violation of federal law. The ATF requires all prospective gun owners to disclose marijuana use and other controlled substances when filling out an ATF Firearms Transaction Record.

Rakoff cites studies that link pot use to increased violence, although he does point out that the rates of violence among illegal drug users and marijuana smokers should not be conflated.

The research in whether or not cannabis does spark violent behavior is mixed. Some studies state that while marijuana may factor in property crime, it does not necessarily increase rates in violent criminal activity such as manslaughter, robbery, rape or assault. Other research has found that crime rates are more likely to escalate when pot use is illegal and that cannabis dispensaries do not correlate to higher crime statistics.

Researchers from the criminology program at the University of Texas-Dallas discovered in a 2014 study that in 11 states where medical marijuana was legal, there were no heightened crime rates. Long-term increases in crime, however, could be attributed to the escalation in drug use from pot to cocaine or heroin.

“The raw number of homicides, robberies, and aggravated assaults also appears to be lower for states passing MML [medical marijuana legalization] as compared to other states, especially from 1998–2006,” the study reported. “[T]hese findings run counter to arguments suggesting the legalization of marijuana for medical purposes poses a danger to public health in terms of exposure to violent crime and property crimes.”