In a move LGBTQ advocates are hailing as a significant policy reform, inmates in New Jersey’s prison system will now be placed in facilities based on their gender identity, not their sex assigned at birth.

The ACLU of New Jersey on Tuesday announced the change, part of a settlement reached with the state’s Department of Corrections over a 2019 lawsuit filed by a transgender inmate who is identified in court documents as Sonia Doe.

She was housed for a year and a half in a men’s prison — where she said she was subjected to discrimination, sexual abuse, and harassment by fellow inmates and staff — and after filing suit was transferred to the Edna Mahan Correctional Facility for Women in Hunterdon County.

“When I was forced to live in men’s prisons, I was terrified I wouldn’t make it out alive. Those memories still haunt me,” she said in a statement announcing the settlement.

The new housing policy for transgender, nonbinary, and intersex inmates comes as New Jersey’s prison system is in a state of upheaval, spurred by the treatment of women incarcerated at Edna Mahan. In January, NJ Advance Media reported a criminal investigation was underway and more than 30 guards had been placed on leave following allegations of brutality inside the facility.

Ten guards now face charges, and a state-commissioned report released earlier this month concluded that staff used excessive force and broke department policy. Within days of the report’s release, the corrections commissioner resigned and Gov. Phil Murphy announced the state will close Edna Mahan, its only women’s prison.

» READ MORE: N.J. settles misconduct claims with women inmates for $21 million

The process of closing Edna Mahan is expected to take years, and it’s unclear where the women incarcerated there will be transferred. ACLU-NJ staff attorney Tess Borden said the policy for placing transgender inmates will apply no matter the state facility, adding, “Trans women should be moved to another female facility just like the cisgender women.”

The Department of Corrections didn’t respond Tuesday to a request for comment.

The woman who filed the lawsuit is no longer incarcerated. According to court papers, she entered prison in March 2018 “for offenses stemming from” an addiction to prescription pain pills. Attorneys declined to specify when she was released in order to preserve her anonymity.

New Jersey’s move is an agency policy shift. Three other states — California, Massachusetts, and Connecticut — have passed laws requiring inmates to be placed in facilities aligned with their gender identity.

Each of those states has exceptions that allow for placements to be denied or reversed based on gender identity if officials document a security problem or adjustment issue. New Jersey’s new policy, which takes effect Thursday, says placements can’t be denied if the adjustment issue is solely because of an inmate’s gender.

The policy requires prison officials to ask inmates questions about gender identity and pronouns during intake, and inmates don’t need to prove gender through legal documentation. Current inmates may also request transfers.

A committee will review and issue decisions on requests, and requesters can appeal directly to the state corrections commissioner.

In addition to placements, the department’s new policy overhauls staff interactions with transgender inmates, requiring they use appropriate pronouns and honorifics and providing privacy protections during showers and strip searches. The policy also guarantees inmates have access to gender-affirming commissary items.

According to the settlement, the policy will be distributed to staff — including all correctional officers — within the next month. They will be required to sign and acknowledge that they read it.

“The Department of Corrections’ practice had been to house people according to their genitalia instead of their gender identity,” Borden said. “This signals a tremendous shift.”