(CNN) The Supreme Court on Monday ruled in favor of two doctors who were convicted of prescribing dangerous opioids without valid medical justification in violation of federal law.
Lawyers for the doctors appealed their convictions, arguing that a jury should have been able to consider whether they reasonably believed that they were acting within professional boundaries. The government had argued such a standard was not necessary.
The court ruling for the doctors was unanimous, but the justices differed 6-3 on the legal rationale.
Justice Stephen Breyer, writing for the majority, said that for the prosecution of the doctors to be successful, the government "must prove beyond a reasonable doubt that the defendant knowingly or intentionally acted in an unauthorized manner."
The so-called "pill mill" case -- coming amid a nationwide opioid crisis -- pits a doctor's ability to dispense controlled substances for pain management against the government's push to prosecute doctors who are prescribing dangerous drugs in the absence of a medical justification.
Lower courts have divided on the standard to use when determining whether a doctor should be charged with criminal liability. While some courts have said a doctor's good faith belief that he or she was acting within medical norms is not relevant to criminal liability, others have said that the government must demonstrate that a doctor knowingly prescribed drugs in illegal circumstances. They say the law was not meant to criminalize well-intentioned conduct when a doctor prescribes drugs to treat patients with legitimate medical needs.
Monday's court opinion will make it less difficult for patients to receive certain treatments. The court in other areas has expressed concern with the overuse of federal criminal law that might threaten innocent conduct.
"Today's decision puts the burden on the government when prosecuting doctors for wrongfully prescribing controlled substances, to show not only that the prescription did not serve a legitimate medical purpose, but that the doctor knew as much when they wrote it," said Steve Vladeck, CNN Supreme Court analyst and professor at the University of Texas School of Law. "In that respect, it likely arms doctors going forward with a strong defense that they made a good-faith mistake, which could help them avoid criminal liability, although perhaps not civil or ethical repercussions."
The dispute concerned pain management doctor Xiulu Ruan, who operated a medical clinic in Alabama called Physicians Pain Specialists, as well as Shakeel Kahn, who ran a similar practice in Arizona.
Both men were convicted under the Controlled Substances Act, which makes it a crime for any person to "knowingly or intentionally" to dispense a controlled substance and received lengthy sentences. Under the law, there is an exception for a licensed health care professional who is allowed to dispense some of the drugs with a prescription, but the prescription must fall within "the usual course of professional practice."
That is, the prescriptions are only lawful if they are issued for a legitimate medical purpose.
Between January 2011 and May 2015, Ruan's clinic issued nearly 300,000 controlled substance prescriptions earning him more than $3 million. More than half of the drugs prescribed were so-called Schedule II drugs that are among the most dangerous drugs on the market. They include opioids such as fentanyl, hydrocodone, morphine and oxycodone, which can mask pain but also lead to addiction. The clinic was raided by the FBI and doctors were charged with running a "pill mill" which prescribed controlled substances for no legitimate medical purpose.
A lawyer for Kahn acknowledged that his practice "did not live up to the model of consistency that one might hope for a practice specializing in long term pain management" especially because some of his patients were selling the medications.
"Dr. Kahn testified that he would not have issued prescriptions to individuals that he knew to be selling their medication," his lawyers told the court. He was sentenced to 25 years in prison.
Lawrence S. Robbins, a lawyer for the Ruan, argued that the doctors can't be convicted under the law without regard to whether they "reasonably believed" or "subjectively intended "that the prescriptions fell within the usual course of professional practice.
In other words, Robbins said, the government must prove that the doctors lacked a good-faith basis for issuing prescriptions.
The Justice Department, on the other hand, argued that a doctor's good faith beliefs do not wholly insulate him from prosecution.
In briefs, the government noted that in the past 20 years there has been a "massive nationwide crisis in the abuse of prescription opioids," and that death from overdoses average more than 40 per day with a total of more than 165,000 such deaths since 1999.
Deputy Solicitor General Eric Feigin told the justices that lawyers for the doctors were "really asking this Court to transform their (Drug Enforcement Administration) registrations, which are premised on the idea that they're actually practicing medicine, into licenses to, at their own subjective views, violate the general rule that drug pushing is illegal."
He said, "they want to be free of any obligation even to undertake any minimal effort to act like doctors when they prescribe dangerous, highly addictive, and in one case, lethal dosages of drugs to trusting and vulnerable patients."
This story has been updated with additional information.