California Gov. Jerry Brown rejected legislation on Sunday that would have allowed San Francisco to open what could be the nation's first supervised drug injection site under a pilot program. Advocates of "safe injection" sites say the locations would save lives by preventing drug overdoses and providing access to counseling.

But the U.S. government and other critics say taxpayers should not be helping users shoot up heroin, methamphetamine or other illegal drugs.

"Fundamentally I do not believe that enabling illegal drug use in government sponsored injection centers — with no corresponding requirement that the use undergo treatment - will reduce drug addiction," Brown said in his announcement of the veto.

Get Breaking News Delivered to Your Inbox

San Francisco Mayor London Breed has vowed to open a supervised injection site, saying the status quo is not acceptable in a city known for rampant drug use. It's not uncommon to see people injecting drugs in public, and used needles are a major source of trash.

"Safe injection sites save lives," she said Sunday. "If we are going to prevent overdoses and connect people to services and treatment that they badly need to stop using drugs in the first place, we need safe injection sites."

The country is struggling with an opioid epidemic that has led to rising overdose deaths. The increase has been attributed to the painkiller fentanyl and similar drugs that are powerful but relatively cheap and cut into street drugs without buyers' knowledge.

San Francisco has reported about 200 overdose deaths annually in recent years, largely from opioids.

AB186 would have protected staff and participants from state prosecution related to illegal narcotics.

But it gave no legal cover from federal laws, including a "crack house" statute that makes it a felony to knowingly maintain a place for using a controlled substance.

San Francisco has not shied away from confronting the U.S. government and has repeatedly sued the Trump administration, including one lawsuit over sanctuary protections for people in the country illegally.

The issue of drug injection sites would likely wind up before a federal judge if San Francisco opens a clinic, legal experts say.

Robert Mikos, who teaches federalism and drug law at Vanderbilt Law School, said a quasi-medical facility where the goal is to reduce harm sounds well-intentioned but appears to violate a statute used to go after people who run drug dens.

"It would depend on whether federal prosecutors are willing to prosecute this violation," he said. "Federal prosecutors always have some discretion, and they have some independence from Washington, D.C., and the attorney general, but this is a tricky situation."

Leo Beletsky, an associate professor of law and health sciences at Northeastern University, said a federal judge might find in San Francisco's favor.

"If you got it before a judge, it's anyone's guess," he said. "You can make a very reasonable argument that a health care facility of this sort is not something that was ever intended to be covered under the crack house statute."

There are safe injection sites in Canada and Europe, but none in the United States. Seattle, New York, and Philadelphia are among cities that have pledged support.

Days after California lawmakers sent the legislation to the governor in August, U.S. Deputy Attorney General Rod Rosenstein wrote in The New York Times that the federal government would take aggressive action against any supervised injection sites.

"Americans struggling with addiction need treatment and reduced access to deadly drugs. They do not need a taxpayer-sponsored haven to shoot up," he wrote.

State Sen. Scott Wiener, a San Francisco Democrat and co-author of the legislation, says the city has no qualms about taking on the federal government over what he calls a failed war on drugs.

He noted that the city has long led the country on health and safety policy as well as on challenging the federal government.

"We implemented needle exchange before it was legal. We implemented medical cannabis before it was legal, and we have always been on the forefront of the sanctuary city movement," he said.