Public defenders who work for Cook County, which includes Chicago, are dealing with what can only be described as nightmare levels of sexual assault and harassment, according to a lawsuit filed in Illinois federal court on Wednesday by six female lawyers.

Male inmates in courtroom lockups and Cook County Jail, one of the country’s largest, repeatedly exposed themselves and masturbated in front of lawyers, law clerks and interns, making it nearly impossible for them to do their jobs, according to the lawsuit and other public complaints and reports.

The situation was widely known, but authorities did little to stop the behavior, the plaintiffs claimed.

The women filed the suit against their boss, Public Defender Amy Campanelli, and against Cook County Sheriff Thomas Dart, charging that Campanelli and Dart failed to take adequate measures to fix some of the most egregious examples of a hostile work environment.

“It is difficult to communicate with clients when other inmates are exposing their genitals, erect or flaccid, masturbating, while either staring at us or yelling at us to get us to look,” wrote Crystal Brown, one of the defenders who filed the lawsuit, in a separate complaint lodged at the Equal Employment Opportunity Commission last month. “This conduct is offensive, degrading and unwelcome.”

In the first 10 months of the year, 222 detainees in Cook County were charged with indecent exposure, and in more than half of those cases, the victims worked at the jail. Twenty-nine of the victims were public defenders. Many did not file complaints out of fear of retaliation, according to the lawsuit. A similar number of incidents were logged last year.

The suit comes at a moment when women across the country in a range of professions are opening up about sexual harassment and are increasingly unwilling to tolerate this behavior. Complaints from female lawyers and corrections officers have similarly been growing as more women take on jobs in formerly male-dominated fields.

The public defender’s office did not immediately respond to HuffPost’s request for comment on the lawsuit. But in a March letter to Dart, who is widely considered a progressive sheriff, Campanelli characterized the situation as a crisis.

“Our attorneys are being forced to work in an environment that is traumatizing and debilitating,” Campanelli wrote. “These attacks have also affected the safety of the workplace. Attorneys are reluctant to talk to clients for fear of being sexually or physically assaulted.”

“It’s just become pervasive. We’ve tried everything,” wrote Campanelli, who became public defender in 2015.

She asked the sheriff for more guards to be present at lockups and other pressurized times. The sheriff did bring in more guards in the spring, but Campanelli said they were pulled in August, according to the Chicago Sun-Times.

Our attorneys are being forced to work in an environment that is traumatizing and debilitating. Cook County Public Defender Amy Campanelli

Campanelli’s letter highlighted a key reason that this situation has been allowed to fester for at least two years, according the lawsuit. The public defender’s office has an interest in both protecting the victims here ― the assistant public defenders ― but also in protecting the inmates, their clients.

The sheriff’s office, which runs the jail and the lock-up rooms at the courthouse, has proposed more punitive measures to handle inmates who commit sexual assault and harassment, but the defender’s office has been hesitant to go along.

For example, after an inmate exposed himself while in lockup ahead of a courtroom appearance, the sheriff’s office wanted to prevent him from then appearing in court. However, in her letter to Dart, Campanelli said that this wasn’t a viable solution since it compromises inmate’s rights and would delay cases.

“It’s frustrating to say the least, that when we put forth creative solutions, to have them thwarted by the public defender’s office,” Cara Smith, chief policy officer for the Cook County Sheriff’s Office, told HuffPost on Thursday.

“We have to put aside for a moment the fact that these individuals are their clients,” she said. “No one should have to work in an environment that’s uncomfortable or harassing. Our commitment to solving it goes back years.”

Smith said that issues with exposure and public masturbation are not unique to the Cook County system. However, the Illinois Public Defender Association and the Illinois Sheriffs’ Association recently told the Chicago Sun-Times that no other jail has a problem on a similar scale.

The Cook County Jail houses about 7,500 inmates and is notorious for being a so-called dumping ground for the mentally ill. According to a 2015 report in the The Atlantic, 1 in 3 inmates are suffering from some kind of mental illness.

Frank Polich / Reuters Cook County correctional officers enter the maximum security part of the jail in Chicago on Feb. 12, 2006.

The jailhouse behavior is particularly bad in the divisions housing inmates who are classified as requiring maximum security facilities, according to the complaint, which emphasizes that the exposure and masturbation is intended to threaten female defenders and law clerks.

One of the plaintiffs, Samantha Slonim, pressed criminal charges against a detainee who masturbated at her while in the courthouse lockup in 2016. After that, she was placed in the same lockup with him three more times, according to the complaint. At those times, he yelled that he would “beat the shit out of” her and “motherfucking kill” her, according to the complaint.

Another plaintiff, Erika Knierim, asked Dart to say something to the detainees who were repeatedly exposing themselves. According to the suit, Dart told her “that she could file a charge but nothing would happen; at the end of the day it is not going to stop; and she should just do her job.”

Smith, from the sheriff’s office, said there is absolutely no truth to this claim. She also said that the sheriff’s office had not yet received a copy of the complaint.

The female public defenders also allege that inmates have grabbed them by the legs or buttocks. And at least one male inmate reportedly ejaculated on a public defender.

Male attorneys are not subject to the harassment, but they’re in the minority. More than 60 percent of the public defenders in Cook County are women, according to the complaint.

The plaintiffs say that little has been done to stop the behavior, despite much outcry, conference calls, memos and meetings.

If an assistant public defender files a complaint, detainees are charged with misdemeanor public indecency. But that’s done little to deter the behavior, since these men are facing serious felony charges, according to the lawsuit.

The women also fear reprisals, according to the suit. One assistant defender who did file a complaint was bad-mouthed by her superiors and throughout the court system for doing so, the lawsuit says.

Brown and the other women who filed the suit with employment law firm Potter Balanos say they are seeking class action certification on behalf of at least 200 female lawyers and interns in the public defender’s office who are likely subject to this harassment.

Read the full lawsuit here.