In a scathing decision, a federal court in California has ruled that the Drug Enforcement Administration's interpretation of a recent medical marijuana bill "defies language and logic," "tortures the plain meaning of the statute" and is "at odds with fundamental notions of the rule of law." The ruling could have a broad impact on the DEA's ability to prosecute federal medical marijuana cases going forward.

At issue is the Rohrabacher-Farr amendment to last year's government spending bill. The amendment lists the states that have medical marijuana laws and mandates that the Justice Department is barred from using federal funds to "prevent such States from implementing their own State laws that authorize the use, distribution, possession, or cultivation of medical marijuana." Pretty straightforward, right?

When the legislation was passed, advocates and lawmakers on both sides of the issue agreed that the bill basically prevented the DEA from going after medical marijuana dispensaries, provided that such dispensaries were acting in compliance with state law. The DEA, however, didn't see it that way. In a leaked memo, the Justice Department contended that the amendment only prevents actions against actual states — not against the individuals or businesses that actually carry out marijuana laws. In their interpretation, the bill still allowed them to pursue criminal and civil actions against medical marijuana businesses and the patients who patronized them.

The DoJ's reading of the amendment infuriated its sponsors. They called for an investigation into the Department of Justice's "tortuous twisting of the text" of the bill, saying it violated common sense. Yesterday, Judge Charles Breyer of the U.S. District Court in northern California agreed.

Breyer goes through the arguments against the DoJ's case, referring to the floor debate as well as the plain language of the bill. But, "having no substantive response or evidence, the Government simply asserts that it 'need not delve into legislative history here' because the meaning of the statute is clearly in its favor," Breyer writes. "The Court disagrees." He called the DoJ's interpretation of the amendment "counterintuitive and opportunistic."

Seeing it as perhaps the final nail in the coffin of the DEA's years-long involvement with California's medical marijuana program, medical marijuana advocates are cheering the ruling. "It's great to see the judicial branch finally starting to hold the Justice Department accountable for its willful violation of Congress's intent to end federal interference with state medical marijuana laws," said Tom Angell of Marijuana Majority.

Dan Riffle of the Marijuana Policy Project agreed. "This is a big win for medical marijuana patients and their providers," he wrote in a statement, "and a significant victory in our efforts to end the federal government’s war on marijuana. Federal raids of legitimate medical marijuana businesses aren’t just stupid and wasteful, but also illegal."

The amendment's congressional sponsors are happy too. "After months of experiencing the Department of Justice’s refusal to follow the letter and intent of the ‘Rohrabacher-Farr’ provision, a federal court has finally reined them in," said Rep. Dana Rohrabacher in an email. "Judge Breyer’s rebuke of DoJ’s ridiculous interpretation of our amendment is most welcomed."

The ruling could discourage the DoJ from creative interpretations of the Rohrabacher-Farr amendment going forward, which should let medical marijuana businesses and their patients in 23 states breathe a sigh of relief.

Lynette Shaw, owner of the Marin Alliance for Medical Marijuana, the dispensary whose case was at issue in the federal ruling, told the San Francisco Chronicle that “we won the war. And I’m the first POW to be released.”

Neither the Justice Department nor the DEA responded to a request for comment.

This story has been updated with reaction from Rep. Dana Rohrabacher.

Christopher Ingraham writes about politics, drug policy and all things data. He previously worked at the Brookings Institution and the Pew Research Center.