The U.S. Supreme Court ruled unanimously on Monday that a federal appeals court will have to take a second look at two cases in which doctors were convicted of misusing their licenses and illegally overprescribing controlled substances.

Former physicians Xiulu Ruan and Shakeel Kahn are currently serving 21 and 25 years in prison, respectively. Both were accused of running “pill mills,” basically doctors’ offices that routinely prescribe opioids and other addictive medications with little to no medical justification, according to Reuters.

Ruan ran a clinic and pharmacy with his partner, former doctor John Patrick Couch, in Mobile, Alabama. The two men were charged with a litany of federal crimes, including perjury, RICO conspiracy, conspiracies to commit wire fraud, mail fraud, healthcare fraud, violating the Anti-Kickback Statute, and money laundering.

Their operation made over $4 million in four years, dispensing over 300,000 prescriptions in that time, many of which were for opiates.

For his part, Kahn ran clinics in Arizona and Wyoming with his brother, Nabeel Kahn. They operated primarily on a cash-only basis but sometimes accepted trades in exchange for medical services, including at least one gun.

CLICK HERE TO GET THE DALLAS EXPRESS APP

After the fatal overdose of patient Jessica Burch, the pair were charged with drug distribution resulting in death, operating a criminal enterprise, and using a gun in furtherance of a federal drug trafficking crime.

In both cases, Ruan and Kahn’s attorneys objected to jury instructions that outlined “objective frameworks” by which jurors judged the defendants’ mental culpability. Specifically, mental culpability could be established if “the doctor’s actions were either not for a legitimate medical purpose or were outside the usual course of professional medical practice.”

The defense argued instead that it was incumbent on the prosecution to prove beyond a reasonable doubt that the defendants “subjectively knew that [their] prescriptions fell outside the scope of [their] prescribing authority.”

Because the doctors had been licensed with that authority, defense attorneys argued, it was not in and of itself a crime for them to exercise that authority by filling out prescriptions. It would first have to be proven by the state that they intended to behave criminally by filling out those prescriptions.

Still, both defendants were convicted and subsequently appealed to the U.S. Court of Appeals. They lost those cases and ultimately appealed to the Supreme Court, which found in their favor.

The Court’s written opinion reasoned that once defendants provide evidence in criminal court that they had legal authorization to prescribe controlled substances like opioids, it becomes incumbent upon prosecutors to prove that the defendants knew they were acting with criminal intent.

The ruling stressed that courts must parse through and distinguish between knowing criminal behavior and good-faith medical errors.

Rather than vacate their convictions, the Supreme Court remanded the matter back down to the U.S. Court of Appeals for reconsideration.