A judge in Maryland has forced prison officials to overhaul their treatment of transgendered inmates, after a transgender prisoner reported repeated sexual abuse at the hands of correctional officers in a maximum-security prison.

Transgender advocates are calling it a landmark case that puts prisons on notice, and shines a light on the nearly 40 percent of transgender inmates who report experiencing sexual assault or abuse while incarcerated.

"Transgender prisoners are unfathomably at risk for sexual abuse," Chris Daley, Deputy Executive Director at Just Detention International, an advocacy group that works to end sexual abuse in detention, told VICE News. "It's a crisis"

The Maryland case focused on Sandy Brown, a 40-year-old transgender woman serving a 5-year sentence for assault, who was sent to Maryland's Patuxent prison in February 2014 for a psychological screening. Guards at the facility referred to Brown as "it" and "some kind of animal" — they repeatedly mocked her body, gawked at her in the shower, and one guard encouraged her to commit suicide.

Brown filed a complaint in April, accusing prison officials of violating the federal Prison Rape Elimination Act (PREA). In a ruling made public by Brown's lawyers on Thursday, Administrative Law Judge Denise Oakes Shaffer sided with Brown.

It's one of the first times, advocates say, that a transgender person has leveraged the PREA to change prison practices, and could clear the way for an overhaul of how the prison system treats inmates nationally.

"When we are talking about trans people, we are talking about a population who are among the most vulnerable in our prisons," Rebecca Earlbeck, a lawyer representing Brown, told VICE News. "We hope this ruling will have a cascading effect."

Judge Shaffer had issued the ruling in May, but her decision was only circulated among state officials. The details of the ruling became public on Thursday. In a scathing opinion, Schafer found that the prison "created a hostile environment," for transgender prisoners. Despite federal requirements, the prison "failed to train all employees in how to effectively and professionally communicate with transgender inmates," the judge wrote.

As a result Patuxent prison was in direct violation of PREA — which requires facilities to train their staff on how to interact with transgender inmates respectfully, and mandates a zero-tolerance policy for inmate sexual abuse.

"Patuxent must promulgate comprehensive policies and institute mandatory training regarding transgender inmates, in compliance with the Prison Rape Elimination Act," the judge ordered. "These policies are to include guidance regarding: strip search procedures for transgender inmates; housing determinations for transgender inmates; and appropriate interaction between correctional officers and transgender inmates."

The judge also awarded Brown $5,000 for her mistreatment.

Gerard Shields, a spokesman for the Department of Public Safety and Correctional Services in Maryland, told the AP on Thursday, that there had been a "total shift in agency thinking" since the initial complaint was filed. And he said the prison system had adopted new policies for dealing with transgender inmates.

Speaking after the ruling became public, Brown described her experience at Patuxent as traumatic. "They didn't see me for the human being I am," she said. "They treated me like a circus act. They gawked, pointed, made fun of me and tried to break my spirit."

But she sees the ruling as a giant step forward for inmates like herself.

"To the other transgender and intersex women behind bars, don't give up," she said. "There is hope out there for us."

Congress enacted PREA in 2003, but specific guidelines for prisons were not promulgated until 2012. Those guidelines do include special consideration for gay, lesbian, and transgender prisoners, but Brown's lawyers say her case represents the first time an inmate successfully used the law to force a change in prison policy.

"As far as we know this is the first time any transgender person has experienced relief under PREA," Earlbeck said. "This means that trans people everywhere — and trans-people in Maryland in particular —will begin to have real protections that they desperately need."

The most recent data on Maryland correctional facilities reveals a system lagging behind federal mandates. The AP obtained a 2014 audit showing four of the six jails in the state had no policy for searching transgendered inmates — a key requirement of PREA. Shields, with the Department of Safety, says that things have changed since the audit and that guards no longer conduct searches "for the purpose of determining one's genitalia."

Transgender advocates say that Brown's case is just the tip of the iceberg. "This is pretty typical of the failure to implement PREA around the country," Harper Jean Tobin, the director of policy at the National Center for Transgender Equality, told VICE News. "Many states and counties haven't gone to the trouble of copying and pasting the PREA guidelines into their manuals."

"We still have a long way to go," Daley with Just Detention International agreed. "But decisions like this show we are on our way to being more successful."