In a landmark ruling handed down Tuesday, the 9th U.S. Circuit Court of Appeals barred the federal government from spending money to prosecute medical marijuana defendants who follow state laws.

The opinion — a big win for the cannabis industry — comes less than a week after the U.S. Drug Enforcement Agency’s controversial decision to keep cannabis on its list of most dangerous drugs, underscoring the clash between states that have chosen to regulate medical marijuana and a federal government that refuses to acknowledge it exists.

Until now, cannabis businesses operating in states that allow medical marijuana have relied primarily on a nonbinding promise from the Justice Department that it won’t go after state-legal medical marijuana programs. But although federal prosecutors have yet to challenge state laws themselves, they continue to pursue criminal charges and forfeiture actions against individuals operating in those states. In doing so, the feds often manage to prevent defendants from even mentioning state medical marijuana laws in court.

Here’s Why the DEA Will Never Reschedule Cannabis

Tuesday’s opinion should change all that — at least in the nine states where it’s now binding precedent. The ruling hinges on the interpretation of a 2014 congressional budget rule that restricts the Department of Justice from spending money to prevent states “from implementing their own State laws that authorize the use, distribution, possession, or cultivation of medical marijuana.”

Writing for a unanimous three-judge panel, Judge Diarmuid F. O’Scannlain acknowledged that the provision “is not a model of clarity.” But the court interpreted it to mean that the Justice Department cannot spend money “for the prosecution of individuals who engaged in conduct permitted by the State Medical Marijuana Laws and who fully complied with such laws.”

The court’s opinion sends 10 pending cases in California and Washington back to trial court. Under the ruling, the cases may go forward only if the defendants violated state law.

“If DOJ wishes to continue these prosecutions, Appellants are entitled to evidentiary hearings to determine whether their conduct was completely authorized by state law,” O’Scannlain wrote, “by which we mean that they complied with all the relevant conditions imposed by state law on the use, distribution, possession, and cultivation of medical marijuana.”

Twenty-five U.S. states now have medical cannabis laws on the books.

Which States are Most Likely to Legalize Cannabis in 2016?

“This is the beginning of the end of federal prosecutions of state medical marijuana dispensary operators, growers, and patients,” Marc Zilversmit, an attorney representing five people who operate four dispensaries in Los Angeles and nine indoor growing sites in L.A. and San Francisco, told the Associated Press.

It’s still unclear how the ruling will affect individuals convicted under federal law after the congressional budget rule took effect. Defendants in Washington state known as the Kettle Falls Five, for example, received prison sentences last year over cannabis cultivation they argue was protected under state law. 

Lawyers for the Justice Department argued in Tuesday’s case that by prosecuting private individuals rather than taking legal action against the state, the federal agency didn’t prevent state medical marijuana programs from functioning — a crucial provision of the congressional budget rule. 

The court’s reply: “We are not persuaded.” 

O’Scannlain gently reminded the Justice Department of basic civics, explaining that Congress has the authority to decide how taxpayer funds may be spent. When Congress adopted the 2014 budget rule, the court wrote, it expressly cut off funding for cases against state-legal cannabis entities and their operators. Continuing the cases would be unconstitutional.

Bill to Limit Police Property Seizures Sails Through California Assembly

On the other hand, the court warned that its ruling doesn’t give carte blanche to cannabis businesses. Some defendants who appealed the Justice Department cases argued that federal prosecutors should be prohibited from filing charges against any state-licensed actors, regardless of whether or not they comply with state law. The court said that would go too far.

After establishing the new protections, O’Scannlain warned the cannabis industry that they may not last forever. After all, the halt in prosecutions is the result of only a temporary budget rule — one that could end at any time.

“Congress could restore funding tomorrow, a year from now, or four years from now, and the government could then prosecute individuals who committed offenses while the government lacked funding,” the judge wrote. “Moreover, a new president will be elected soon, and a new administration could shift enforcement priorities to place greater emphasis on prosecuting marijuana cases.”

 Is Hillary Clinton Evolving on Cannabis? Maybe. Slowly. A Little.