In a rare move, a Northern California district court judge has directed the state to grant a transgender inmate’s sex reassignment surgery — marking a first in the state’s history. The judge said the procedure is the “only adequate” treatment for her condition.

Michelle-Lael Norsworthy, 51, was born as Jeffrey Bryan Norsworthy. In the 1990s, she started living as a woman in state prison and was later diagnosed with severe gender dysphoria, a condition in which people identify with a different gender from the one they were born with, according to court documents. California corrections officials have said she has been given proper medical care over the years, including counseling and hormone therapy, the Associated Press reported.

However, U.S. District Court Judge Jon S. Tigar in San Francisco said on Thursday that the department denied her request for sex reassignment surgery, or SRS, likely because it has a policy against approving it as a treatment for transgender inmates. He granted a preliminary injunction, telling the prison system to let her have the operation “as promptly as possible.”

“The weight of the evidence demonstrates that for Norsworthy, the only adequate medical treatment for her gender dysphoria is SRS, that the decision not to address her persistent symptoms was medically unacceptable under the circumstances, and that [California Department of Corrections and Rehabilitation] denied her the necessary treatment for reasons unrelated to her medical need,” Tigar wrote in his ruling. Denying her the surgery, he said, would violate her constitutional rights.

The injunction ordering the state prison system to grant the surgery is a novel ruling. It’s reportedly the first time such a decision has been made in California, and it has been seen only one other time in the country, Ilona Turner, legal director at the Transgender Law Center, told the AP.

In 2012, a federal judge ordered the Massachusetts Department of Corrections to provide the procedure for a transgender inmate. The 1st U.S. Circuit Court of Appeals overturned the ruling late last year and, last month, the inmate’s attorneys took it to the U.S. Supreme Court.

In 1987,  Norsworthy was convicted of murder and sentenced to life behind bars. She is now being held at an all-male prison called Mule Creek State Prison, some 40 miles from Sacramento. Officials have argued that if she has the surgery, keeping her in that facility — or any men’s prison — could put her at risk for sexual assault. Moving her to a women’s prison, they said, could put her or other inmates at risk because she has a history of domestic violence, the AP reported.

The California Department of Corrections and Rehabilitation said it is considering whether to appeal Tigar’s order. If the department complies, Norsworthy reportedly will be the first transgender inmate in California to undergo the operation. The procedure could cost the state as much as $100,000, Joyce Hayhoe, a spokeswoman for California Corrections Health Care Services told the Los Angeles Times.

The Transgender Law Center said that price is a “gross exaggeration.”

“This decision confirms that it is unlawful to deny essential treatment to transgender people” in or out of prison, Kris Hayashi, executive director of the Transgender Law Center, told the AP. “The bottom line is no one should be denied the medical care they need.”