A federal government ban on the sale of guns to medical marijuana card holders does not violate the 2nd Amendment, a federal appeals court said Wednesday.

The ruling by the 9th U.S. Circuit Court of Appeals applies to the nine Western states that fall under the court's jurisdiction, including California, Washington and Oregon.

It came in a lawsuit filed by S. Rowan Wilson, a Nevada woman who tried to buy a firearm in 2011 after obtaining a medical marijuana card.

The gun store refused, citing the federal rule on the sale of firearms to illegal drug users.

Marijuana remains illegal under federal law, and the Bureau of Alcohol, Tobacco, Firearms and Explosives has told gun sellers they can assume a person with a medical marijuana card uses the drug.

The 9th Circuit in its 3-0 decision agreed that it's reasonable for federal regulators to assume a medical marijuana card holder is more likely to use the drug.

In addition, a ban on the sale of guns to marijuana and other drug users is reasonable because the use of such drugs "raises the risk of irrational or unpredictable behavior with which gun use should not be associated," Senior District Judge Jed Rakoff said.

The 9th Circuit also rejected other constitutional challenges to the ban that were raised by Wilson.

An email to Wilson's attorney was not immediately returned.