In a ruling that could clear the way for the first supervised injection site in the nation, a federal judge ruled Wednesday that a Philadelphia nonprofit’s plan for a facility where people could use drugs under medical supervision does not violate U.S. law.

U.S. District Judge Gerald A. McHugh said that a 30-year-old law targeting so-called crack houses would not apply to Safehouse’s overdose-prevention purpose, as Justice Department officials had argued.

“The ultimate goal of Safehouse’s proposed operation is to reduce drug use, not facilitate it,” the judge wrote.

McHugh’s opinion was immediately hailed as a victory by harm-reduction advocates who said it could also shape the legal debate in other U.S. cities.

But just how soon Philadelphia might see a supervised injection site is unclear.

» READ MORE: Frequently asked questions about how Safehouse would operate

“We have maintained that the federal laws couldn’t possibly be interpreted to stop people from saving other people’s lives,” said Ronda Goldfein, Safehouse’s vice president and the director of the AIDS Law Project of Pennsylvania. “It’s not over by any stretch. At this very first level of judicial determination, the court has agreed that that law is not intended to stop us from saving lives.”

While saying they felt vindicated by the judge’s decision, Safehouse officials noted the legal process could continue.

“We’re not quite there yet,” said Ilana Eisenstein, Safehouse’s attorney. “It’s a big step forward and it certainly lays the groundwork for a final judgment in our favor.”

Justice Department officials, who had asked the judge to declare the supervised injection plan illegal, vowed an immediate appeal.

“This case is obviously far from over,” said U.S. Attorney William M. McSwain, who had argued the case himself in court. “We look forward to continuing to litigate it, and we are very confident in our legal position.”

Deputy Attorney General Jeffrey Rosen warned in a separate statement: “Any attempt to open illicit drug injection sites in other jurisdictions while this case is pending will continue to be met with immediate action.”

Supervised injection sites, which have operated for decades in Canada and Europe, allow people to use drugs such as heroin under medical supervision and be revived if they overdose.

Backers, which include Mayor Jim Kenney and District Attorney Larry Krasner, say the sites could save lives in the midst of an overdose epidemic that has killed more than 3,000 in the city alone in the last three years.

But skeptics, including some residents of Kensington — the epicenter of the city’s drug crisis and the most likely location for a site — have raised concerns that a site could concentrate drug use in their neighborhood and trigger more drug-related violence.

In crafting his decision, McHugh noted Wednesday that it was not his role to decide whether supervised injection sites were an appropriate means of dealing with the opioid crisis, either as a matter of public policy or public health. He also said that he did not have jurisdiction to address the Kensington residents’ objections.

He limited his task to determining whether the 1986 law known colloquially as the “crack-house statute” applied to the type of facility that Safehouse has proposed. The relevant portion reads: “It shall be unlawful to … manage or control any place … for the purposes of unlawfully manufacturing, storing, distributing or” — most central to Safehouse’s case — “using controlled substances.”

Lawyers for the nonprofit argued at a hearing last month that the 33-year-old law was passed at the height of the crack-cocaine epidemic to go after the owners and tenants of drug dens. Medical staff and advocates seeking to prevent overdose deaths were never part of the discussion, they said.

But the Justice Department maintained that the plain language of the law was clear. If advocates wanted to change the law, McSwain argued in court, they should lobby Congress.

McHugh turned that around, writing that lawmakers could not have been thinking about supervised injection sites when they passed the “crack-house law” and that if Congress wanted to specifically outlaw facilities like Safehouse it was up to them to amend the statute.

“No credible argument can be made that facilities such as safe injection sites were in the contemplation of Congress either when it adopted [the crack-house statute],” he wrote.

Safehouse’s organizers still must address several concerns before they could open their facility. They have not publicly announced a location. Kenney has suggested the city develop a policing plan before opening a site. Goldfein, who is married to Inquirer editor David Lee Preston, said the group hopes to continue building support among Kensington residents.

“Hopefully, the city will have a public safety plan in place for residents when this opens,” said Shannon Farrell-Pakstis, leader of the Harrowgate Civic Association — the neighborhood north of Kensington that was considered a potential spot for a site. “I hope that it works, for all of us.”

Supporters still allowed themselves some measure of celebration Wednesday.

Former Gov. Ed Rendell, who serves on the Safehouse board, was making plans within hours of the ruling to contact potential donors who might have been skittish about funding Safehouse in the past.

His first call, though, was to his friend Thomas A. “Tad” Decker, the prominent Philadelphia attorney who lost his son, John, to an opioid overdose in 2016, he said.

“My first thought was of John Decker and the 1,217 people who died from overdoses in Philadelphia [in 2017] and the 1,100-plus who died last year,” he said.

Rohit Mukherjee, a community organizer with SOL Collective, a harm-reduction group that serves Philadelphia drug users, hailed the ruling as “a step away" from War-on-Drugs-era thinking — "racist drug policy rooted in stigma and hatred toward low-income communities of color.”

When Devin Reaves, the head of the Pennsylvania Harm Reduction Coalition, first heard the news he started to cry.

“This is going to save some people’s lives,” said Reaves, who has been in recovery for 12 years. “I’m tired of my friends dying.”

» READ MORE: What to expect when your city is expecting a supervised injection site: Lessons from around the globe | Perspecti