(If you’re having trouble viewing this video on a mobile device, click here.)

SAN JOSE — Three former correctional officers convicted of fatally beating a mentally ill inmate were each sentenced Friday to 15 years to life in state prison, concluding a case that sparked community outrage and exposed Santa Clara County’s wholesale neglect of its jails.

Relatives and friends of former guards Jereh Lubrin, Matt Farris and Rafael Rodriguez sobbed in the packed courtroom as Judge David A. Cena sentenced the men for the second-degree murder of bipolar inmate Michael Tyree. Despite dozens of heartfelt letters from the men’s families, pastors and in Farris’ case several retired police officers, the judge declined to grant their request of no more than a year in county jail.

“Love you, Matt” one woman shouted. “Te amo, mi niño,” another woman told Rodriguez, wailing as she got up to leave the courtroom.

Lubrin, 30, and Rodriguez and Farris, both 29, must serve the full 15 years in prison under the current rules before they can apply for parole.

The stiff sentence in a case involving excessive force by law enforcement officers was relatively unusual. But the judge had little choice once he ruled that the other two sentences at his disposal — up to a year in county jail or no jail at all — were “inappropriate.” He was then compelled under state law to sentence them to the mandatory term for second-degree murder: 15 years to life in prison.

Cena did so in an even-handed manner, noting that letters from Tyree’s friends and family, including one read aloud by the prosecutor, “made it clear he (Tyree) was loved and will be missed.” But the judge also expressed compassion for the former guards’ relatives and friends, who had tried to persuade him in the letters that the men were of good character.

The judge said that the prison sentence, which was also recommended by a probation officer, doesn’t mean the former guards are “bad people,” adding: “I also regret the impact on their friends and family.”

Tyree, 31, was in jail awaiting a bed in a residential treatment center for the mentally ill on Aug. 26, 2015, when he suffered what the prosecution characterized as an “agonizing and painful” death inflicted inside his 12.5′ x 6′ cell by the three trained, physically fit and armed guards.

One of Tyree’s two sisters, Shannon Tyree, had planned to fly in from New York City, but her flight was canceled because of frigid weather conditions on the East Coast. In a three-page letter read aloud by prosecutor Matt Braker, she said Michael was tormented by his disease, especially after their father died, and refused to accept his inheritance and her many offers of assistance.

“When he would tell me people were after him, including me, I would dismiss it as delusion and paranoia and tell him no one was after him,” she wrote. “But in the end, he was right. These three men were after him, maybe just on a whim that night, and maybe not intending to kill him, but they were after him. And he is dead.”

The former guards, who had been on the job for three years or less, were convicted in June after the jury rejected the defense argument that Tyree’s injuries — including to his spleen, small bowel, liver, face, skull and the front and back side of his body — were the result of an accidental fall or suicide.

One juror who attended the sentencing but declined to give his name said he thought the guards deserved prison rather than probation, but not 15 years.

The stark choice in the disparate penalties is intended to give judges limited discretion in rare cases, rather than force them to abide entirely by rigid sentencing laws that California first enacted in 1977.

Some advocates of criminal justice reform expressed hope that the sentence would deter other jail guards from using excessive force. But while the guilty verdict in the case sent a message that such conduct was unacceptable, some of the county’s more than 700 correctional officers saw it as unfair and hoped the judge would go easy on the former guards.

Attorney Paula Canny, who helped represent the Tyrees in their lawsuit against the county, said the significance of the denouement is much more far-reaching.

“It’s a wake-up call for everyone, not just for the guards,” she said. “You just can’t put mentally ill people in jail. It’s insane. Michael’s illness pales next to the systemic illness of the criminal justice system.”

Tyree’s death sparked a close review of the jails run by Sheriff Laurie Smith, including by a special civilian-led commission. The county has implemented some reforms, including installing cameras in most locations in the jails and beefing up spending on mental health services. But critics continue to call for more changes and for replacing Smith, who faces a re-election battle for her sixth term against two opponents in the June primary. In September, the county settled a lawsuit filed by Tyree’s family for $3.6 million.

The Board of Supervisors is expected early this year to approve more jail oversight, in the form of an independent inspector-general.

Outside the courthouse Friday, District Attorney Jeff Rosen commended prosecutor Matt Braker for his “exceptional talents” in guiding the case to a “just” conclusion and also thanked sheriff’s investigators for their work.

The three former guards are not representative of the well-meaning men and women in the criminal justice system, Rosen said, but he acknowledged that “we have to work every day to win back the public’s trust.”

During the two-month trial, the evidence presented by prosecutor Braker against the former guards included texts, sent primarily by Farris, that referred to inmates being ”twisted up,” “sprayed,” “kicked,” “locked down,” “slapped” and “beaten the (expletive) down.”

Prior to sentencing, the defense Friday sought a new trial, claiming that Cena should not have allowed the jury to see what they dubbed as “inflammatory” texts. But Cena rejected the request.

Braker contended that the texts indicated that the guards enjoyed causing prisoners — particularly mentally ill inmates — discomfort and pain.