A federal appeals court has held that the government can enforce federal drug laws on federal lands, even in a state that's legalized medical marijuana such as California.

The U.S. Court of Appeals for the Ninth Circuit on Thursday found that although Congress has prohibited the U.S. Department of Justice from using appropriated funds in ways that prevent states from implementing medical marijuana laws, it didn't bar it from prosecuting marijuana cases altogether.

The decision comes in the case of Russell Gilmore and Richard Hemsley, who were charged with conspiracy and growing marijuana illegally on land under control of the Bureau of Land Management in El Dorado County, east of Sacramento.

A co-defendant in their case pleaded guilty to conspiracy in November 2015 and Gilmore and Hemsley went to trial in April 2016. After the jury failed to reach a unanimous verdict, the judge declared a mistrial.

Post-trial, the two men's lawyers filed a motion to enjoin federal prosecutors from retrying their case based on an August 2016 Ninth Circuit opinion in a batch of marijuana-related cases.

In the case, U.S. v. McIntosh, the Ninth Circuit found that Congress barred the DOJ from spending money to prosecute individuals who were complying with state medical-marijuana laws. The decision routed the 10 consolidated cases back to trial courts to determine whether the defendants had complied with state laws.

In the McIntosh opinion, however, Ninth Circuit Judge Diarmuid F. O'Scannlain pointed out in a footnote that marijuana is still illegal under federal law in all instances and that 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.”

In Thursday's opinion, the Ninth Circuit held that the judge below—U.S. Senior District Judge Garland E. Burrell Jr. of the Eastern District of California—was correct to deny the defendants' injunction bid under McIntosh.

“Nothing in California law purports to authorize the cultivation of marijuana on federal land,” wrote U.S. District Judge Lynn Adelman of the Eastern District of Wisconsin, for the unanimous Ninth Circuit panel. “Even if state law tolerated marijuana cultivation on public land, federal law forbids such use,” wrote Adelman, who was sitting at the Ninth Circuit by designation.

Circuit Judges Richard Paez and Sandra Ikuta joined the opinion.

Sean Riordan, an assistant federal defender in Sacramento who represents Gilmore, said the defense team is reviewing the decision and hasn't yet decided whether to seek further review. Hemsley's lawyer, Sandra Gillies of Woodland, and the federal prosecutor who argued the appeal, Assistant U.S. Attorney Gregory Broderick of the U.S. Attorney's Office for the Eastern District of California, didn't immediately respond to messages.