A $14 million legal settlement is being proposed by attorneys for Cook County public defenders and law clerks whose class-action lawsuit claims they were subjected to a hostile work environment in which inmates they represented were masturbating in front of them.

On Friday, attorneys for the 534 public defenders and law clerks asked U.S. District Judge Matthew Kennelly to approve the proposed settlement with Public Defender Amy Campanelli and Sheriff Tom Dart, who were named as defendants.

A similar class-action lawsuit by sheriff’s employees is pending.

Under the proposed settlement, the public defenders and law clerks would get a minimum of $9.5 million. Most of the rest — about 30 percent — would go to their lawyers.

The lawsuit was filed in November 2017. Kennelly then issued an injunction to stop the inmates from exposing themselves in front of female public defenders and law clerks.

The judge ordered that inmates who engage in such behavior be required to wear uniforms that limit their access to their groins. He also ordered they be handcuffed behind their backs when they meet with their attorneys and during their transport between jail and court.

In their responses to the lawsuit, Dart and Campanelli have denied they ignored the problem and allowed a harsh work environment.

In a story published in 2016, nearly two years before the lawsuit was filed, the Sun-Times reported that inmates had banded together to attack guards and other officials.

The inmates called themselves the Savage Life gang. Not only were they masturbating in front of female employees in jail and court, they also were throwing feces and urine at guards. The story documented 219 incidents of inmates exposing themselves or masturbating in public between July 1, 2015, and Jan. 20, 2016.

The story said the sheriff pushed for a new law that allowed his office to cancel inmates’ “good time” for committing such acts. Inmates accumulate one day of good time for each day behind bars, which allows them to shorten their sentences.

But Campanelli sent a letter to the sheriff in March 2017 saying the problem was getting worse. “We are in the midst of a crisis that is affecting my ability to provide legal representation to my clients,” she wrote.

Inmates were masturbating in front of her female attorneys and law clerks every day, Campanelli wrote. She said some of her employees were considering filing a hostile-workplace claim and asked Dart for an increased security presence in lockups where her employees come in contact with inmates.

In a court filing Friday, Nieves Bolanos, an attorney for the public defenders and clerks, told Kennelly the masturbation and exposure incidents have “dramatically declined” since the judge issued his injunction in late 2017 to require problem inmates to wear the special jumpsuits and be handcuffed.