A federal judge has approved the release of a video showing Placer County authorities brutally beating and shocking a mentally ill inmate with a stun gun, topping off a two-year legal battle between the man and county officials accused of covering up the abuse.

The judge on Thursday also approved a $1.4-million settlement to be paid to inmates in jails in the Northern California county who accused authorities of using excessive force, said attorney Mark Merin. The lawsuit was filed in August 2017, following the arrest of three county law enforcement officials who were investigated after the video was brought to the sheriff’s attention.

Merin said 15,000 inmates were eligible to make claims as part of the class-action suit. More than 200 will be compensated after attorneys evaluated 458 claims.

Lead plaintiff Beau Bangert, who appears in the recently released video, will receive $50,000 as part of the suit in addition to $250,000 he already received in a separate settlement, Merin said.

In the video, Auburn Main Jail officials rush into a small, isolated cell, slamming Bangert into a wall with a body shield on May 14, 2017. He is punched and kicked several times and shocked with a stun gun before officials push him to the ground and take him out of the cell, leaving a smear of blood on the floor.

Bangert is later wheeled back into the cell and restrained to his chair as he looks upward with a mesh bag over his head. Guards remove the bag and record his blood-covered face, using a body shield to cover him partially, before leaving him in the cell.

Merin said Bangert is schizophrenic and had been circling his cell and repeatedly slamming its door, which annoyed deputies.

Sheriff Devon Bell said a supervisor reviewing routine security camera videos brought the footage to managers, who contacted the Placer County district attorney’s office.

Since the incident, the jail has improved its camera equipment, trained staff on how to interact with mentally ill inmates and installed better tracking software to monitor use of force, said Lt. Andrew Scott, a spokesman for the Sheriff’s Department.

“As you see in the video that has been released to the media, the actions of the officers are troubling and represent conduct that has never been tolerated at our agency,” Scott said in a statement released Thursday on Facebook.

After a joint investigation by the Sheriff’s Department and the district attorney’s office, three law enforcement officials — Sgt. Megan Yaws, Deputy Robert Madden and corrections officer Jeffrey Villanueva — were arrested and charged with falsifying police reports. They initially were placed on paid leave but since have been fired, authorities said.

Bangert, who according to Merin was serving time for a minor charge related to a probation violation, was released from prison in August 2017. He used money from an earlier settlement to buy a home near his parents, who are helping him navigate his new life as a free man, his lawyer said.

“I think there’s been a real effort to change the culture and actions of the staff at Placer County,” Merin said, adding that he hopes the settlement shows what can happen behind closed doors.

“It’s good to shine the light of day,” he said.