SAN FRANCISCO (BCN)—In a victory for medical marijuana advocates, a U.S. appeals court ruled in San Francisco today that medical cannabis users and growers can’t be federally prosecuted, at least for the time being, if they “strictly comply” with their state’s medical marijuana law.

A 9th U.S. Circuit Court of Appeals panel said a 2015 Congressional budget amendment bars the U.S. Department of Justice from spending funds on prosecution of people who use, sell, or grow medical marijuana in compliance with a state law.

The amendment prohibits the agency from using budget money to prevent states “from implementing their own state laws that authorize the use, distribution, possession, or cultivation of medical marijuana.”

The Department of Justice argued that the measure only prevented prosecutors from taking action against states or state officials.

But a three-judge appeals panel unanimously ruled that the “plain meaning” of the law is that it forbids prosecutions of individuals who use, grow or sell marijuana in compliance with their state law.

“If the federal government prosecutes such individuals, it has prevented the state from giving practical effect to its law,” Circuit Judge Diarmuid O’Scannlain wrote for the court.

But the panel warned that “individuals who do not strictly comply with all state-law conditions” can be prosecuted, and also that Congress could restore prosecution funding in future years.

The decision was made in 10 consolidated cases in which medical marijuana growers or retailers were being prosecuted in federal courts in San Francisco, Los Angeles and Spokane, Washington.

They appealed to the circuit court for orders dismissing their indictments or blocking prosecution action.

The court sent the cases back to federal trial judges for evidentiary hearing on whether the defendants had strictly obeyed their state laws.

Marc Zilversmit, a San Francisco lawyer representing Steve McIntosh of Los Angeles, said, “This could be the beginning of the end of the federal war on medical marijuana.”

Zilversmit said he did not know of any other circuit ruling in the nation thus far on the interpretation of the amendment.

“The court clearly rejected the Justice Department argument,” he said.

McIntosh is one of five people being prosecuted in federal court in San Francisco for allegedly operating four Southern California marijuana stores and five indoor marijuana grows in the San Francisco and Los Angeles areas.

For now, the ruling applies to the nine western states in the 9th Circuit’s jurisdiction, eight of which have some type of medical marijuana law.

The decision could be appealed to an expanded 11-judge panel of the circuit court or to the U.S. Supreme Court.

Abraham Simmons, a spokesman for the U.S. Attorney’s Office in San Francisco, said, “We are reviewing the decision.”

California’s Compassionate Use Act, enacted by voters in 1996, protects patients and their caregivers from state prosecution for using, possessing or growing medical marijuana if the patient has a doctor’s approval for the substance.