San Francisco’s top public health official on Wednesday endorsed safe injection sites where intravenous drug users could legally shoot drugs, giving the controversial idea a big boost and setting up a potential clash with Mayor Ed Lee, who has come out strongly against them.

“I think even if we were to open one it would be very successful,” Barbara Garcia, director of the Department of Public Health, said Wednesday at a hearing of the Board of Supervisors Public Safety and Neighborhood Services Committee.

Garcia said to make a real difference the city would need to open up at least six sites, at a cost of around $3 million to $3.5 million annually.

Garcia’s comments were unexpected given the mayor’s opposition. In March, Lee dismissed Supervisor David Campos’ proposal to open up safe injection sites. “We have a vigorous disagreement over allowing people to inject heroin and meth, to literally destroy their bodies and their minds, in a city-funded shelter, as some have proposed,” the mayor said at the time.

Lee’s spokeswoman, Deirdre Hussey, said the mayor, who is on a trade mission to South Korea, continues to have concerns.

“There are many issues with this, the main issue being that it is currently illegal under state and federal law,” Hussey said. “As the director of public health stated, there are many considerations, including what neighborhoods to place them in and what the impact on those neighborhoods would be, as well as medical liability, cost and the long-term effectiveness of such a program.”

But Campos, who sits on the Public Safety and Neighborhood Services Committee, called Garcia’s remarks “very significant.”

“I think most people are open to this as an option, because the status quo is so bad,” Campos said, adding that even so he hadn’t expected Garcia to endorse the idea. “I’m sort of in a way shocked to see the level of progress.”

But there are major hurdles to the city creating safe injection sites, the biggest being that state law currently prohibits them. A bill to allow them failed in the Legislature this year. San Francisco stayed neutral on that bill, but Garcia said the city would throw its support behind future efforts.

“It’s a good idea,” Garcia said after the hearing. “The research has already shown that it does provide a safe access for getting health-related services and also an ability to inject in a safe location.”

Garcia said the city would not open safe injection sites without a change in the state law. No California city has opened a safe injection site, said Laura Thomas, deputy state director of the California Drug Policy Alliance.

Thomas said research shows that opening up public sites where drug addicts can inject saves money, because it reduces the number of people who contract hepatitis C, HIV and soft-tissue abscesses.

“Today’s hearing was a very positive step toward opening supervised consumption services in San Francisco,” Thomas said. “I’m impressed with how much movement there has been in just the last few months.”

In September, a task force in Seattle recommended opening up safe injection sites — if that happens, Seattle would be the first city in the United States to do so.

— Emily Green

Stall on sanctuary: A proposal to spend $5 million to provide legal representation to immigrants living in the country without documentation who face deportation will not be voted on before the end of the year.

Board of Supervisors President London Breed declined to waive a board rule that says new legislation must sit for 30 days before it goes to committee.

That means the newly comprised Board of Supervisors will vote on the legislation sometime in January.

Among the supervisors who will no longer be on the board is David Campos, the bill’s sponsor. Campos had hoped to have it voted on by Dec. 13, his last scheduled board meeting before being termed out of office.

Campos declined to comment. It’s unclear who will carry the bill forward when he is gone. One likely possibility is that his successor, Hillary Ronen, a strong advocate for sanctuary city policies and Campos’ longtime aide, will push it forward.

The legislation is the first major proposal by a city official to counter President-elect Donald Trump’s pledge to deport millions of immigrants who have no legal status. There are some 44,000 such immigrants living in San Francisco.

It calls for giving $2.6 million to the public defender’s office to hire 10 attorneys, five paralegals and two legal clerks to represent detained immigrants, and another $2 million to community legal groups to hire 13 attorneys and six education and outreach staff.

— Emily Green

Email: cityinsider@sfchronicle.com, egreen@sfchronicle.com Twitter: @sfcityinsider, @emilytgreen