As a key federal official vowed to move against Philadelphia's plans to open a safe injection site for drug users, several legal experts countered Thursday that the site could be seen not as breaking the law, but as a lifesaving measure amid an opioid crisis that has resisted traditional measures.

"It's not clear to me that when the city decides legitimately to fight the opioid crisis through medical means, that that violates federal law in any way," said David Rudovsky, a civil rights attorney.

"The city is not doing this for criminal purposes. They're doing this in good faith, and they've had a lot of good evidence on this point — they're doing it for health and safety concerns."

In an interview with WHYY on Wednesday, Deputy Attorney General Rod Rosenstein expressed strong opposition to a site where people in addiction can use drugs under medical supervision, calling it a violation of federal law.  "I'm not aware of any valid basis of the argument that you can engage in criminal activity as long as you do it in the presence of someone with a medical license," he said. City leaders should expect legal action if they permit a facility to open, he said.

Philadelphia officials announced in January their intention to permit the opening of a safe injection site, calling it an important aspect of their response to the opioid epidemic, which took 1,217 lives last year — the highest death rate of any major U.S. city.

The announcement came after city officials visited an established safe injection site in Vancouver, British Columbia, and commissioned a report on evidence collected at sites in Canada and Europe. The report concluded that a single site in Philadelphia would save 25 to 75 lives a year and millions of dollars in hospital costs and public funds.

Advocates see safe injection sites as commonsense tools to help people in addiction while also restoring neighborhoods plagued by public drug use. Opponents fear they will encourage drug abuse and invite outsiders into already-stressed neighborhoods such as Kensington — themes Rosenstein echoed.

"If local governments get in the business of facilitating drug use … they're actually inviting people to bring these illegal drugs into their places of business," Rosenstein said. "If you start down that road, you're really going to undermine the deterrent message that I think is so important in order to prevent people from becoming addicted in the future."

People in addiction need treatment, he added, not access to more drugs. Advocates say that the sites do not provide drugs, just a safe environment where drug users can be revived if they overdose.

Philadelphia Health Commissioner Thomas Farley has said the site would complement the city's other efforts to combat the crisis, like encouraging doctors to prescribe fewer opioids, getting people into treatment quickly, and making the reversal drug naloxone widely available.

When facing "an epidemic of historic proportions," Farley has said, it's worth trying all options to save lives. He pointed to needle exchange programs — widely credited with curbing the AIDS epidemic — as an analogy. Initially there was backlash to such programs but as people saw the benefits, they became more accepted, he said.

Prosecutions in the 1990s against syringe-exchange programs resulted in at least two convictions, according to a 1996 paper by Scott Burris, a public health law professor at Temple University. But at least nine defendants mentioned in the study were acquitted. Some successfully cited the "necessity defense" — in which defendants argue that they broke the law in order to avert imminent danger.

That defense could be used in Philadelphia if Rosenstein decides to pursue criminal charges against a safe-injection site operator, said Jules Epstein, director of advocacy programs at Temple's Beasley School of Law.

The necessity defense "basically means that we broke one law that prevents a harm in order to prevent a much greater harm," he said. "In this case, the argument would be that letting people use drugs is a much lesser harm than having people die."

Still, he said, that argument isn't the easiest to make. Safe-injection site operators would have to prove that there were no other legal alternatives to save people from dying of overdoses, though Epstein said defendants could argue that traditional legal drug treatments are not effectively reducing the death rate.

And they'd have to prove that the danger of clients dying of a drug overdose is imminent: "The argument a prosecutor could make is that because we don't know if any of these particular people are going to overdose, the danger is not imminent," Epstein said.

Rudovsky said it's more likely that the federal government would pursue a case in civil court rather than try a criminal case, but he thinks Philadelphia has a good argument to make in favor of the sites because of the public health purpose.

In a 2008 paper published in the American Journal of Health, Leo Beletsky, a public health law professor at Northeastern University, and Burris wrote that federal authorities could use a federal law known as the "Crack House Statute" to go after cities and states that permit safe injection sites. Under the law, which dates to the crack cocaine epidemic, it's illegal to "knowingly open or maintain … [or] manage or control any place … for the purpose of unlawfully … using a controlled substance."

Beletsky and his colleagues argued that the law was "never intended to interfere with a legally authorized public health intervention," like a safe injection site that's sanctioned by a city or state government. Still, they wrote: "These arguments are reasonable, but are by no means certain to convince federal judges."

Still, several other jurisdictions have moved to authorize the sites. Monday, the California State Legislature passed a bill legalizing supervised injection sites in the state. Seattle, which is close to opening a safe injection site, set aside $1.3 million in its budget last year to open the facilities. Opponents tried and failed to float a ballot measure that would have banned the sites before they even opened.

An unauthorized safe injection site has been operating in an undisclosed location in the United States since 2014. A handful of cities like San Francisco and New York City have announced plans to open sites.