SAN FRANCISCO (KRON) — A 26-year-old San Francisco man was found not guilty of murder after a jury decided that he acted in self-defense during a fight on Folsom Street.

Thomas Ortiz was locked in the San Francisco County Jail for five years before he had a chance to prove his innocence in court. A three-month-long trial ended last week when the jury found him not guilty on all counts.

Prosecutors said Ortiz fatally shot 21-year-old Ernesto Rosales on New Year’s Day in 2017. Ortiz was also 21 years old at the time.

The shooting stemmed from a fight that broke out between two groups of young men who encountered each other outside a convenience store on 26th and Folsom streets in the Mission District, according to his defense attorneys.

“Mr. Ortiz, who is now 26, was jailed for nearly five years before he got to defend his innocence at trial. His defense team worked skillfully and compassionately to show that the prosecution was using fear, rather than facts, to try to prove their case,” San Francisco Public Defender Mano Raju said.

Prosecutors attempted to convince jurors that the killing was gang-motivated because Ortiz had friends who were killed in unrelated incidents, and because he had appeared in a hip hop music video, according to the Public Defender’s Office.

“While this was a difficult and emotional trial for everyone involved, it was especially frightening and outrageous to see the police and prosecutors rely on racist presumptions about Latino men and faulty information to try to associate Mr. Ortiz with a gang in an attempt to scare the jury into overlooking the facts,” said Deputy Public Defender Sylvia Cediel.

The jury deliberated for one week.

“Thomas Ortiz was acquitted because it was an act of self-defense. Mr. Ortiz had never been arrested before. He fired one shot in self-defense after another individual pulled out a weapon and after someone else threw a bottle at Mr. Ortiz’s face,” said Deputy Public Defender Yali Corea-Levy.

According to court documents, the prosecutors believed Ortiz was a member of the Army Street Gang, which is named after housing projects on Cesar Chavez Street. The projects were once infamous for violence, according to the San Francisco Examiner.

“Mr. Ortiz had grown up in a chaotic environment, had been the target of violence before, and had lost friends to violence. We know that he would not have shot the gun if he hadn’t been in fear for his life. In fact, he first used the gun as a blunt object to defend himself in the altercation before he fired a single and tragically fatal shot,” Corea-Levy said.

After a preliminary hearing, Ortiz invoked his Constitutional right to a speedy trial and was entitled to have a trial by March of 2021, defense attorneys said.

Instead, the trial didn’t start until 15 months later, all the while he was in jail during the entirety of the pandemic, defense attorneys said.

“The San Francisco Superior Court’s delays in re-opening more courtrooms for trials in the wake of the COVID pandemic contributed to the egregious delay in this case going to trial,” said Raju.

Raju sued the San Francisco Superior Court in 2021 regarding its failure to re-open enough courtrooms for trials. Raju took legal actions to compel the court to follow state law and prioritize criminal trials for people in custody, hundreds of whom have seen the statutory deadlines for their trials pass.