A federal judge ruled Wednesday that safe drug injection sites, like the ones proposed by San Francisco Mayor London Breed, do not violate the law, turning back an attempt by the Justice Department to shut down such experiments.

Safehouse, a Philadelphia-based nonprofit, wants to open a safe site in its city. But the Justice Department sued the nonprofit, citing the federal Controlled Substances Act and a provision that makes it a crime to own a property where illegal drug use is common—e.g., the “crack house statute.”

However, according to Judge Gerald McHugh, the ultimate goal of Safehouse is to reduce drug use rather than foster it.

Although McHugh’s ruling took place in Philadelphia, the decision could have lasting implications for San Francisco. The city faces its own legal hurdles over a longstanding injection site proposal by Mayor London Breed and city leaders who claim such a site would help homeless addicts and clean up SF streets.

McHugh’s decision (uploaded in full by NPR) adds that “facilities such as safe injection sites were [not] within the contemplation of Congress” when lawmakers wrote the relevant law. He calls the Justice Department’s interpretation of the measure “the broadest extreme.”

In response to the Philadelphia ruling, Mayor Breed said, “Safe injection sites save lives,” a sentiment she has expressed verbatim for years, adding, “they help prevent overdoses, reduce public drug use, prevent the spread of disease, and connect people to medical care that can help treat their addiction.”

The mayor said the city attorney will consider what implications McHugh’s ruling has for San Francisco’s own plans.

Bay Area lawmakers struggled for years to secure permission from the state to open injection facilities in SF.

Gov. Jerry Brown vetoed such a bill when it came to his desk in 2018 using the argument that it wouldn’t help drug problems. And while current Gov. Gavin Newsom supports the plan, the most recent bill stalled in the state senate in May without reaching his desk.

In addition to helping drug users receive treatment, the city hopes that safe sites would prevent open-air drug use in such areas as streets, BART stations, and Muni, as well as reduce the number of discarded needles.

Supervisor Matt Haney, whose district includes SoMa, Mid-Market, and the Tenderloin, has created legislation with the goal of opening a safe injection site possibly somewhere in District Six.

“I am introducing legislation to require that the city treat this like the crisis it is and do everything possible to have a site open immediately,” said Haney.

The city distributes nearly 4.5 million syringes each year, according to the Department of Public Health, but collects only about 60 percent of them in return.

SF Director of Health Barbara Garcia estimated in 2017 that San Francisco has about 22,000 intravenous drug users in all.