Guards at the California State Prison, Corcoran, routinely pepper-spray mentally ill inmates to get them to leave their cells so guards can give them medication or move them to new cells, a lawyer representing the inmates in a lawsuit told Al Jazeera on Friday.

Lawyers representing about 30,000 inmates are seeking a ban on the use of pepper spray against the mentally ill. U.S. District Judge Lawrence Karlton on Thursday ordered the prison to release six videotapes, which guards had recorded to comply with laws requiring that they document the removal of inmates from cells.

"Anyone who watches will frankly be shocked at the treatment these prisoners are receiving, supposedly for their own good," attorney Jeffrey Bornstein said by phone from San Francisco. "What we’ve demonstrated so far in this trial, we believe, is the seriously mentally ill are being punished for their mental illness."

Prison authorities said such cell extractions are not done lightly.

"Use of force is always a last resort for our staff, and cell extractions are typically done to keep inmates from harming themselves or others and to ensure that they are placed in a more appropriate mental health setting," Deborah Hoffman, a spokeswoman for the California Department of Corrections and Rehabilitation (CDCR), told Al Jazeera.

"As we are always looking to improve our policies, CDCR is revising use of force policies to limit the duration of pepper spray applications, the total applications and the minimum waiting period between applications in non-emergency situations," said Hoffman.

Final arguments in the case will be made early next week.

"We’re hoping it changes the culture here in California," Bornstein said.

In one video, published to the web by The Los Angeles Times late Thursday, "a seriously mentally ill inmate, losing touch with reality," according to Bornstein, is pepper-sprayed five times as guards, wearing gas masks and hazmat suits, wait for him to handcuff himself so they can remove him from his cell to administer medical treatment.

"Spray him again," one guard repeatedly says. At one point, someone who appears to be a prison staff member not wearing a suit walks by, cupping her nose and mouth. Someone off-camera starts coughing during the last few administrations of pepper spray.

"What you don’t see on these videos is the hours of discussions that take place between the inmate and clinical staff before a cell extraction is ordered and the video camera starts rolling," Hoffman said.

In the video, the prisoner shrieks and repeatedly calls for help. Eventually, when he emerges from the cell — apparently without putting up a fight — he is forced to the ground by guards.

"You are choking me," he screams, writhing on the ground, his body glistening from the pepper spray, as one guard appears to press down on the back of his neck.

The inmate, according to Bornstein, sat naked in his cell after prison physician Ernest Wagner had left him for days until the prisoner's condition was severe enough for Wagner to seek a court order to remove him for treatment.

Bornstein told Al Jazeera that in the days that followed, the inmate was strapped to a five-point restraint or "suicide" bed.

"He wasn’t allowed to go to the bathroom except on himself while he was strapped to that bed," Bornstein said.

Wagner had not responded to interview requests at time of publication.