A California appeals court overturned the gun conviction against an undocumented immigrant who shot and killed Kate Steinle in San Francisco four years ago — a case that drew international attention and energized then-candidate Donald Trump’s calls for a border wall and an end to “sanctuary cities.”

Jose Ines Garcia Zarate was acquitted of murder and manslaughter charges after a more 2017. Only one charge stuck then: The jury ruled him guilty of being a felon in possession of a firearm.

But in a decision filed Friday, the state’s 1st District Court of Appeal threw out the conviction because the judge failed tell the jury it could acquit Garcia Zarate if it was persuaded by his defense that he only momentarily had the gun — which is not legally the same as possession of a firearm.

Garcia Zarate’s public defender told The Associated Press he believes the jury would have acquitted him had it been properly instructed.

Justice Sandra Margulies, who penned the 3-0 ruling, sided with the defense, saying that the jury asked the trial judge for the definition of possession and whether there was a time requirement for the charge.

“These questions go to the heart of the momentary possession defense,” she wrote. “The fact the jury asked whether there was a time requirement for possession suggests jurors were wrestling with how long defendant had the gun.”

During his trial, Garcia Zarate said he unwittingly picked up a stolen gun that was wrapped in a T-shirt while he roamed a pier on the city’s waterfront that night, in July 2015. The gun went off, and his attorneys said the bullet hit the ground 12 feet away and ricocheted 78 feet into Steinle’s back.