Inmate Michelle-Lael Norsworthy, right, speaks as her attorney Kate Brosgart listens during her parole hearing at Mule Creek State Prison in Ione, Calif., Thursday, May 21, 2015. (Steve Yeater/AP)

In a historic victory for transgender rights in prisons, California became the first state to agree to pay for the sex reassignment surgery of Shiloh Quine, a transgender woman who has been serving a life sentence for the past 35 years.

In a settlement reached on Friday, California's department of corrections said that it would pay for Quine's medical care and move her to a women's prison after completion of the surgery. In a statement, the corrections department said that every medical expert who examined the case testified that "this surgery is medically necessary for Quine," according to the Los Angeles Times.

Quine will be examined by a doctor as soon as this week and will undergo surgery shortly thereafter, Flor Bermudez, a spokesperson for the Transgender Law Center which represented Quine, told VICE News.

"After years of unnecessary suffering, Shiloh will finally get the care she desperately needs - and transgender people nationwide will hear a state government affirm that our identities and medical needs are as valid as anyone else's," said Kris Hayashi, the Director of Transgender Law Center in a statement.

The state conceded that the only way for Quine to treat her severe gender dysmorphia, which medical and psychological experts testified to, was to undergo surgery to match her genitalia with the gender she identified with.

The decision to pay for Quine's surgery was aided by the recent case of another transgender prisoner represented by the Transgender Law Center, Michelle Norsworthy. In April, a federal judge ruled that the state must pay for Nortsworthy's sex reassignment surgery, a first in California. But the state fought the ruling and on Friday Governor Jerry Brown agreed to parole Norsworthy, likely meaning that the state would not pay for the surgery.

Quines is serving a life sentence for murder without the possibility of parole, so unlike Norsworthy she could not wait until she left prison to pay for the surgery on her own.

Norsworthy and Quines' lawyers argued that prisons were violating their clients' constitutional rights by failing to provide sex-reassignment surgery to them. Under the Eight Amendment, prisons are required to provide medically necessary care to inmates and failing to do so amounts to "cruel and unusual punishment."

"The fact that the state of California settled this matter means that they recognize that the Constitution guarantees the right to medically necessary medical care," Bermudez told VICE News.

"There is a clear medical consensus that gender dysmorphia is a serious medical need and it should be treated like all other medical needs in and outside of prison," Chase Strangio, a staff attorney for transgender rights at the American Civil Liberties Union told VICE News.

Arguments against mandating that states provide sex reassignment surgery are often made on the basis of the alleged security concerns for inmates and the cost of the procedure, says Strangio.

Other opponents see sex-reassignment surgery as cosmetic and medically unnecessary.

"We're talking about surgery on parts that are not damaged," Michael Rushford, the President of the Criminal Justice Legal Foundation, told VICE News. "It's crazy that the state would provide this type of treatment for a criminal serving time in prison."

Rushford cautioned that Quine's case also opens up the possibility for other transgender people in California prisons seeking the state-funded surgery.

"The best thing to do if you want the surgery is to come to California, commit a felony and get imprisoned," he added.

Regardless of the debate surrounding the medical and psychological concerns that result in the denial of sex-reassignment surgery, it is indisputable that transgender inmates are subject to far higher rates of sexual violence in prison. One study found that nearly 60 percent of transgender women housed in male prisons in California experienced sexual assault, compared to only four percent of non-trans prisoners. Nationally, 40 percent of transgender inmates experienced at least one incident of sexual assault between 2011 and 2012, according to data from the Justice Department. Prison staff committed more than 15 percent of those assaults.

Quine and Norsworthy are not the first transgender inmates to demand the government pay for their surgeries. In 2012, after more than a decade of legal battles, a Massachusetts judge ruled that transgender inmate Michelle Kosilek had the constitutional right to tax payer-funded hormone therapy and sex-reassignment surgery. But this decision was appealed and Kosilek, who had previously tried to castrate and kill herself, was later denied the surgery.

385 transgender inmates in California are currently receiving hormone therapy paid for by the state, according to Joyce Hayhoe, a spokesperson for the California Correctional Health Care Services.

Although Quine's case was settled before it reached a court, it could likely be cited as a precedent for other cases in which the federal government is required to pay for sex-reassignment surgery, says Bermudez. As of 2014, Medicare reversed the ban on paying for sex-reassignment surgeries, but Medicaid still does not cover the surgery in many states. The military also does not cover any gender-related surgeries.

Quine's settlement is huge victory for trans people in prison, Strangio says, but there is still work to be done.

"We're still dealing with widespread bias and ignorance when it comes to trans medical rights...The more that the courts and the public are educated on the medical necessity of gender dysmorphia, the more changes we're going to see elsewhere like in the military and Medicaid on the state level."

Follow Olivia Becker on Twitter: @obecker928