In this Sept. 23, 2013, file photo, inmates walk the halls in formation at Tutwiler Prison for Women in Wetumpka, Ala. (Dave Martin/AP)

The Justice Department announced Thursday that it has reached an agreement with the state of Alabama and its corrections department to compel reforms at a women’s prison where inmates for years have faced sexual assault by predatory correctional staff.

The more than 900 prisoners inside the maximum-security Julia Tutwiler Prison for Women in Wetumpka, Ala., have lived “in a toxic environment” where they have been raped, sodomized, forced to engage in oral sex and fondled, according to an investigation by the Justice Department.

Officials at Tutwiler helped organize a “strip show’ with female prisoners, and male correctional officers openly watched them shower and use the toilet, investigators found.

When inmates tried to report the abuse, they were punished and faced threats of physical assault by the staff, according to a complaint filed Thursday by Attorney General Loretta E. Lynch in the Middle District of Alabama.

Investigators also found that prison officials treated women who reported sexual abuse “with the presumption that they were lying, subjecting them to polygraph examinations as a prerequisite to investigating the allegation.”

Women who tried to report abuse were also routinely placed in segregation with limited or no access to a telephone, visitors or programs for a long time, according to the investigation.

“Prisoners are entitled to be safe from sexual predation by staff, and to live in an environment free from sexual assault, sexual harassment and the constant fear of these abuses,” said Vanita Gupta, the head of the Justice Department’s Civil Rights Division.

Under the agreement, Tutwiler must install a “state-of-the-art camera system. Staff must be trained in preventing, detecting and responding to sexual abuse at the prison. And the prison is required to implement a program to track and analyze data to ensure that abuse and harassment are being adequately addressed.

The agreement also requires Tutwiler to reverse “dangerously low staffing levels,” especially of female officers, and ensure there is sufficient staff to maintain safety.

An independent monitor will evaluate Tutwiler’s efforts and provide compliance reports to federal court every six months.

The state women’s prison near Montgomery, Ala., opened in 1942 and was named for Julia Tutwiler, an advocate for the improvement of prison conditions. In 2007, the Justice Department identified Tutwiler as the women’s prison with the highest rate of sexual assault allegations in the country.

The department opened its investigation in 2013. It included an on-site inspection, interviews with staff members and dozens of inmates and the review of policies, reports and training records.

In January 2014, the Justice Department issued a findings letter, concluding that Tutwiler subjected female prisoners to a “pattern or practice” of sexual abuse in violation of the Eighth Amendment prohibiting cruel and unusual punishment.

Inmates at Tutwiler “universally fear for their safety,” according to the letter to Alabama Gov. Robert Bentley (R), signed by then-Acting Assistant Attorney General Jocelyn Samuels.

“Officials have been on notice for over eighteen years of the risks to women prisoners, and, for over eighteen years, have chosen to ignore them,” she wrote.

Bentley said Thursday he has begun the changes, including creating the position of deputy commissioner of women’s services, charged with implementing the changes at Tutwiler.

“I am proud of the reforms we have made at Tutwiler,” Bentley said in a statement, “and I know we have more to do.”