U.S. District Judge Gerald McHugh ruled last week that the proposal from “Safehouse" — a nonprofit planning to open a privately-funded safe injection facility supported by citizens including former Gov. Ed Rendell — does not violate federal law. This means a public health measure proven for decades to prevent opioid overdoses and foster recovery from substance use disorder is a step closer to being available for residents of Philadelphia.

While this is encouraging news, backers of Safehouse will face additional legal hurdles, including an appeal of Judge McHugh’s ruling to the Third U.S. Circuit Court of Appeals.

Fortunately, there is a way forward for Safehouse and other facilities like it.

The legal battle has gone on for some time. Wrangling over the legal status of Safehouse’s plan commenced in February, when U.S. Attorney William McSwain filed suit seeking a declaratory judgment that the proposed facility would violate the 1984 federal “Crack House Statute.” This law makes it a crime to “knowingly and intentionally” make an facility available “for the purpose of unlawfully using a controlled substance.”

The Justice Department has been adamant that this language applies to safe injection facilities like Safehouse. In 2018, then-Deputy Attorney General Rod Rosenstein even took to the pages of The New York Times to warn that any attempt to open such a facility anywhere in the country would face “swift and aggressive action."

But Judge McHugh rebuffed that response last week in a thoughtful and exceptionally thorough opinion, determining that a law designed to punish people who deliberately encourage illicit drug use could not plausibly be read to apply to people, like the backers of Safehouse, whose goal is to reduce overall drug use by helping guide individual users off the path of addiction and into recovery.

» READ MORE: Judge: Philly supervised injection site proposal does not violate federal law

DOJ will challenge that interpretation on appeal by arguing that providing a safe place to consume opioids falls within the literal meaning of the statute, even if it is done for the specific purpose saving lives and encouraging cessation. Besides having to convince the appeals court to embrace a hypertechnical statutory interpretation that does not plausibly reflect legislative intent, DOJ will have to contend with the even more fundamental argument on appeal that Congress simply lacks the authority to regulate purely local, non-economic activities like operating what amounts to a charitable treatment facility where nothing is bought, sold, produced, or distributed.

Notably, the Third Circuit Court of Appeals recently flipped from majority-Democrat-appointed to majority-Republican. Conservative judges tend to be particularly sympathetic to the proposition that Congress’ “Commerce Clause” powers are finite and do not extend to purely non-commercial activities.

On the policy side, safe injection facilities have been in use outside the United States since the 1980s and operate today in more than 120 sites in major cities across Europe, Canada, and Australia. An underground facility has been operating in the U.S. since 2014. Multiple studies have repeatedly shown they work to prevent overdose deaths, the spread of HIV and hepatitis, and have the added benefit of helping many addicts get needed treatment for addiction and other health problems.

» READ MORE: Stopping illegal safe injection sites is exactly what the U.S. attorney is supposed to do | Christine Flowers

Despite that evidence, State Sen. Anthony Williams plans to offer legislation that would outlaw safe injection sites across Pennsylvania in order to focus resources on prevention and treatment. But while prevention and treatment are certainly helpful, they’ve done little to stem the flow of overdose deaths. More than 1,100 people died of overdoses in Philadelphia in 2018.

Senator Williams claims Safehouse would enable drug use but the reality is that drug addiction is an illness, not a vice. Denying users access to a safe site is akin to denying insulin to diabetics who won’t alter their eating habits—it is neither humane nor effective.

Harm reduction advocates in Seattle, San Francisco, New York, and Boston, are closely following the Safehouse case. If Safehouse is ultimately able to open its doors in Philadelphia, look for the model to spread across the country. That would be good news for those who doubt the federal government’s ability to solve the opioid crisis with prosecutions and prisons.

Clark Neily is Vice President for Criminal Justice at the Cato Institute. Jeffrey A. Singer practices general surgery in Phoenix and is a senior fellow at the Cato Institute.