SAN FRANCISCO (AP) — A California federal judge on Monday sentenced the Mexican man acquitted of murder in the 2015 shooting death of a woman on a San Francisco pier to the seven years he's already spent in jail — bringing to a legal close the case that ignited a national firestorm over immigration, crime and sanctuary cities.

Jose Inez Garcia Zarate was in the U.S. illegally when Kate Steinle, 32, was fatally shot along a crowded Pier 14 where she was walking with her father and a family friend. He faces deportation and U.S. District Judge Vince Chhabria told him in court to never return to the U.S.

The shooting shocked a country already divided over immigration and fueled Donald Trump’s successful campaign for president. Trump called for a crackdown on unlawful immigration and the sanctuary cities and states — including San Francisco and California — that refuse to cooperate with federal immigration authorities.

Garcia Zarate admitted firing the gun on July 4, 2015, but said he found it under a bench and didn't know what it was when he picked it up because it was wrapped in a T-shirt. The gun fired accidentally after he picked it up, he said. Officials said the bullet ricocheted off the ground and hit Steinle.

He was acquitted of homicide charges by a San Francisco jury in 2017 but faced firearms charges in federal court. In March, he pleaded guilty to being a felon in possession of a firearm and a person illegally in the country in possession of a firearm.

“If you return to this country again and you are back in front of me, I will not spare you. Let this be your last warning: do not return to this country,” Chhabria said before sentencing Garcia Zarate to the time he has already served.

Chhabria also delivered a harsh rebuke of the mental health treatment received by Garcia Zarate for his schizophrenia while in custody, which the judge said was virtually nonexistent.

Garcia Zarate will be sent to Texas, where he faces a federal judge for failing to report his location when he was released from a San Francisco jail shortly before the shooting. He had been deported five times and was on track to be removed from the U.S. again when he shot Steinle.

The maximum sentence on the firearms charges was 10 years. Prosecutors agreed to the sentence of time served plus three years of probation. Garcia Zarate's lawyers wanted a shorter sentence so he could apply any time left over in case the judge in Texas imposes additional prison time.

The handgun belonged to a U.S. Bureau of Land Management ranger who reported it stolen from his parked car a week before Steinle was killed.

Before the killing, Garcia Zarate had recently completed a prison sentence for illegal re-entry to the U.S. when he was transferred to San Francisco to face a 20-year-old marijuana charge.

Prosecutors declined the case, but the San Francisco sheriff released him from jail despite a federal immigration request to detain him for at least two more days for deportation.

Garcia Zarate "feels horrible about what happened, and that he’s very sorry and apologizes,” his lawyer, Mike Hinckley, said in court Monday.

The judge said he does not believe that prosecutors proved that Garcia Zarate had acted with criminal recklessness in the shooting and that he likely did not understand what was happening that day when he killed Steinle, because of his mental health illness.

Chhabria also expressed sympathy for Garcia Zarate, who spent most of his seven years in county jail without medication or meaningful treatment.

Two doctors diagnosed Garcia Zarate with schizophrenia and found him unfit to stand trial because he could not follow the court proceedings.

"That must have been hell," Chhabria said.

But the judge also said that consequences matter and that Garcia Zarate admitted being a felon in possession of a firearm.

Steinle's relatives were not present in court for the sentencing and prosecutors said her family did not want to participate in the proceedings.

Copyright 2022 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed without permission.