Immigrant rights activists prayed for supervisors to override Mayor Gavin Newsom's veto.
The supervisors want to change his policy which allows the city to release to federal authorities illegal immigrant minors arrested on a felony.
Supervisor David Campos' bill would allow the city to hand them over only if they are convicted of a felony or they are charged as an adult.
"I would ask the mayor respectfully to please work with us, to please follow the laws that are duly enacted by this board," said Campos.
The supervisors overrode the veto, 8-3, but the mayor says he will ignore the new policy based on the advice of City Attorney Dennis Herrera who sent a memo.
Herrera says a federal legal challenge is likely. And that "there is a serious risk that a court will find that federal law pre-empts the proposed amendment, and possibly the entire sanctuary city ordinance."
"We can't put our law enforcement officials in the position of breaking the law. We can't force them to follow this law," says the mayor's spokesman Nathan Ballard.
"He may very well believe this law is not legal, but it's not up to him to decide that," said Campos.
Late on Tueday, Herrera sent a letter to U.S. Attorney Joe Russoniello, asking for assurances that if the city does implement the new policy, he will not prosecute city employees for violating federal law.
The legislation becomes law in 30 days. Supervisor Campos says if the mayor continues to ignore the new policy, proponents may go to court to challenge his position.