SAN FRANCISCO — Jose Inez Garcia Zarate grinned broadly and hugged his public defender tightly immediately after a jury acquitted him of killing a young woman on a San Francisco pier.

Getting Matt Gonzalez to represent him was unquestionably a stroke of good luck for the five-times-deported Mexican national in the case that caused a national political firestorm on immigration that reached all the way to the White House.

Gonzalez is the top deputy in the public defender’s office, a well-respected lawyer who has argued many trials in San Francisco courtrooms and has deep roots in the city’s powerful progressive political base.

“San Francisco juries are different than other juries,” defense attorney Michael Cardoza said. “Matt knows San Francisco juries.”

Gonzalez has said he won eight acquittals for men facing life in prison in his first nine years with the public defender’s office, a job he took after graduating from Stanford University law school in 1991.

The Texas native took a four-year break to serve on the San Francisco Board of Supervisors and has immersed himself in the city’s art and literary scene. He has published a book of poetry, operates an art gallery and was nearly elected mayor as a Green Party candidate in 2003.

Gonzalez did not return a phone call from The Associated Press on Friday, a day after a jury found Garcia Zarate not guilty of murder and involuntary manslaughter. He was found guilty of felon in possession of a firearm and will be sentenced later this month on that count.

The death of Kate Steinle prompted a national debate over immigration because Garcia Zarate had been deported five times before the shooting.

“There are a number of people that have commented on this case in the last couple of years — the attorney general of the United States, the president and vice president of the United States — let me just remind them that they themselves are under investigation by a special prosecutor in Washington, D.C.,” Gonzalez said after the verdict was delivered. “They may themselves soon avail themselves of the presumption of innocence and beyond-a-reasonable-doubt standard.”

City Public Defender Jeff Adachi represented Garcia Zarate at his first court appearance in July 2015 but quickly handed the case to Gonzalez.

“I knew Matt as a fearless trial lawyer who cared very much about the clients of the office,” Adachi said about his hiring Gonzalez as his top deputy in 2011. “He treats everyone with respect regardless of whether you’re a politician or homeless.”

Gonzalez won a seat on the Board of Supervisors, San Francisco’s equivalent to a city council, in 2000 after switching his party affiliation from Democratic to Green in the middle of the race.

While on the board, he helped pass a law that significantly limited the number of retail chain stores in the city and raised his profile in the progressive community by battling the administration of Mayor Willie Brown.

He became a hero of the city’s left when he gave a serious challenge in the 2003 mayor’s race to Gavin Newsom, who is now California’s lieutenant governor and among the front-runners in the governor’s race.