Only a few weeks ago, San Francisco Mayor Ed Lee, Supervisor David Campos and Public Defender Jeff Adachi joined other city officials on City Hall’s marble staircase to declare unity in the fight against President-elect Donald Trump’s threats to withhold funding from sanctuary cities.

That veneer of unity is already fracturing.

While he pledged to fight to protect immigrants living here illegally and facing deportation, Lee is balking at Campos’ legislation to give Adachi $2.6 million to represent detained immigrants in deportation proceedings.

The mayor instead wants to fund only community legal groups specializing in deportation defense. Under Campos’ legislation, those groups would receive $2 million to represent immigrants facing deportation who are not being detained.

The mayor “wants the public defender to go through the regular budgeting process if they want more staff and resources,” said Deirdre Hussey, the mayor’s spokeswoman. “At the end of the day, community-based organizations are already doing this work, and we should be building on their success.”

It’s unclear if Lee wants to redirect the money for the Public Defender’s Office to community groups to defend detained immigrants.

But Lee’s reluctance to fund the public defender is drawing opposition not only from Campos and Adachi, but also from the community legal groups Lee favors. They say Adachi’s involvement is crucial in creating long-term stability and ensuring universal representation for immigrants facing deportation.

“To do this at the scale that is needed we need a partner like the Public Defender’s Office, who we already know and trust,” said Ana Herrera, managing attorney at Dolores Street Community Services, which defends immigrants facing deportation.

She said the Public Defender’s Office is “perfectly poised to scale up” to represent detained immigrants, while community legal groups can take the lead on representing immigrants who have not been detained. The Public Defender’s office would “institutionalize the defense that is needed,” Herrera said.

Campos’ legislation would allocate $2.6 million to the public defender to hire 10 new attorneys, five paralegals and two legal clerks to represent detained immigrants facing deportation whose cases are assigned to the San Francisco Immigration Court.

Another $2 million would go to community legal groups to represent immigrants facing deportation who are not being detained and provide education about legal rights to other immigrants living here illegally. An additional $400,000 would go to nonprofits to staff a hotline and provide emergency legal representation in the case of immigration raids.

Campos declined to be interviewed, but in a statement emailed by a legislative aide said, “I have yet to see an alternative proposal excluding the Public Defender’s Office that will ensure protection of San Francisco’s entire immigrant community.”

Supervisor John Avalos, a co-sponsor of the legislation, said including the public defender was critical.

“Providing a hybrid approach of public defenders and community-based groups will ensure stronger representation and a much stronger connection to the city that can extend additional resources and clout to the community lawyers.”

The fight over whether to include Adachi in the deportation defense project appears to be both political and practical. One concern from the mayor’s side is that any funding to the Public Defender’s Office would likely become permanent — a challenge at a time when the city is facing a $100-million-plus budget hole and trying to shore up its finances.

The public defender’s budget is currently $34 million and the city currently funds $4.3 million for legal services for immigrants.

Adachi also said he met last week with Steve Kawa, Lee’s chief of staff, who told him “they didn’t want a city agency providing this representation in these cases.” Adachi didn’t expound on what that meant. Asked about it, Lee’s spokeswoman reiterated that the administration supports funding community-based organizations.

Campos’ proposal is based largely on a model implemented in New York, where the City Council allocates $6.3 million to the public defender’s office to defend immigrants facing deportation.

Peter Markowitz, an associate professor at Cardoza School of Law in New York who helped create the blueprint for the New York program, said a key to its success has been its placement in the public defender’s office.

“It runs very much like the criminal public defender system. They regularly staff the first master calendar. They are standing there and pick up every case. They have the resources of their office to do background checks,” Markowitz said.

For now, negotiations between Campos, the mayor’s office, public defender and community groups are ongoing. Lee is expected to propose a counter proposal in the coming days.

Emily Green is a San Francisco Chronicle staff writer. Email: egreen@sfchronicle.com Twitter: @emilytgreen