Lifting a decadelong ban by the state, a district court judge ruled this week that transgender people on medical assistance have the right to gender transition surgeries.

Monday’s decision by Ramsey County Judge William Leary will now allow 64-year-old Evan Thomas, who sued the Department of Human Services, to proceed with surgery that state law had previously denied him.

Thomas’ victory was the first legal challenge of the law, which the judge said was unconstitutional.

“For many of us, the ability to have the surgeries is a matter of life and death,” Thomas said Wednesday. “Feeling you are in the wrong body can be devastating.”

Leary rejected the state’s claim that the coverage ban was because of budgetary constraints and that change to the federal medical assistance program in January that will allow such surgeries made the suit moot.

The suit was filed in December by the American Civil Liberties Union of Minnesota (ACLU) on behalf of Thomas and the advocacy group OutFront Minnesota. It challenged the state’s Medical Assistance and MNCare programs for public insurance for low-income residents. Those programs won’t pay for surgeries such as hysterectomies, mastectomies, vaginoplasty and phalloplasty, among others, if they’re related to gender assignment. But they do cover the same surgeries for other medical needs.

The suit alleged that the law discriminated against people who are transgender, infringed on transgender people’s right to privacy and violated the state Constitution.

Changes were made to the federal Affordable Care Act in July to ensure state medical assistance plans would allow transitional surgeries, and states had until Jan. 1 to implement the changes.

In a statement Wednesday, the Department of Human Services said it supports the court’s decision to strike down the law.

“The department has been working to provide health care services related to gender transition since a federal rule went into effect in July 2016. The district court order brings the state into compliance with this federal rule and ensures the department may provide this service to Minnesotans.”

Over the past three years, Thomas began counseling and more recently, hormone therapy, to transition into a man. But medical assistance wouldn’t cover his request for a double mastectomy.

He said he had known since he was a child that he didn’t feel right in his body, “as if parts of it belonged to another species.”

Thomas was found to have gender dysphoria, a “serious medical condition” of feeling incongruence between birth gender and gender identity. If left untreated, it can lead to significant psychological distress, the suit said.

Thomas describes himself as naturally shy. Going out in public made him anxious, knowing he wasn’t able to fully portray “how I felt about myself in my body.” He had a serious bout of depression and suicidal thoughts, not uncommon in the transgender community, he said.

The state allowed transition surgeries for people on medical assistance for 30 years before coverage stopped in 2005. “OutFront Minnesota is delighted by this ruling,” said Phil Duran, legal director of OutFront Minnesota. “And it could have broader impact on protection of transgender people in schools and other state government programs.”

About a dozen states have Medicaid programs that cover transition surgeries. Although changes to the Affordable Care Act on Jan. 1 would have affected current state medical assistance programs, there could be challenges to the law or changes by the new White House administration, said Teresa Nelson, legal director of the ACLU of Minnesota.

“Having the current law on the state books is a stigma to the transgender community,” she said.

Thomas said the surgery is critical to his well-being. His surgery is planned for this month.

“I’m so happy we won,” he said. “The judge’s ruling is a forceful statement that transgender people deserve equal treatment under the law.”