Denying insurance coverage for transgender health care is unlawful under the Affordable Care Act and federal laws prohibiting sex discrimination, a federal judge in St. Paul ruled Thursday in a case that is being closely watched nationally.

The opinion came in the case of a Minnesota woman who sued her employer, Essentia Health, for denying coverage for her son’s gender transition, including surgery and medications. HealthPartners, as the plan administrator, was also named as a defendant.

While it does not decide the underlying lawsuit, Judge Donovan Frank’s ruling settled a key legal question that could have implications for future transgender health litigation, attorneys said Friday. That would be true especially if the Trump administration follows through on its stated intention to roll back Obama-era regulations that required health insurers to cover transgender health care.

“By denying health care coverage for treatment that was not only warranted but prescribed by a doctor, ­Essentia and HealthPartners clearly discriminated against my son and violated the law,” said Brittany Tovar, a nurse practitioner from Ada, Minn., who used to work for Essentia, a Duluth-based health care system.

“It is a huge victory where there are not many precedents,” said Omar Gonzalez-Pagan, a senior attorney and health care strategist with Lambda Legal, an LGBTQ legal rights group that has no connection with the case. “This is one of three rulings [nationally], all of them in our favor.”

Frank’s opinion came in response to a motion by the defendants to dismiss the case. His decision clears the way for both parties to collect evidence, but more significantly, it set the ground rules for how federal regulations and laws should be interpreted in such cases.

Attorneys at Gender Justice, a St. Paul-based nonprofit that brought the case to court, asserted that Tovar’s son, Reid Olson, was discriminated against because of his gender identity. The defendants questioned whether gender discrimination is illegal under federal laws prohibiting sex discrimination.

Frank concluded that Olson was protected by those laws and the Obama administration’s interpretation that federal sex discrimination laws guaranteed health care for transgender people under the Affordable Care Act. “The judge is very much saying that this is the way that the law should be interpreted,” said Christy Hall, a staff attorney at Gender Justice.

Both defendants declined to comment specifically on the case.

Essentia said it does not comment on pending litigation.

Bloomington-based HealthPartners said in a statement that it supports transgender rights; as part of the motion to dismiss, HealthPartners contended that it should not be held liable because it was only enforcing the coverage decisions made by Essentia.

Frank disagreed and kept HealthPartners as a defendant.

Noting that part of the judge’s ruling, Megan Peterson, executive director at Gender Justice, said: “Even if you are just an administrator of this plan, you need to ensure that the plans you are selling don’t include any discriminatory policies.”

Since the lawsuit was filed, Essentia has changed its benefits to include coverage for transgender health care.

It has also reimbursed Tovar for her out-of-pocket costs associated with her son’s medications. The defendants asked the judge to remove Tovar as a plaintiff, and Frank agreed.

In April, the Trump administration said it would submit new regulations that would remove transgender health protections under the Affordable Care Act, but it has not yet acted on that.

Transgender legal advocates said Thursday’s ruling could still protect health access because it anchors protections in federal anti-discrimination law, not just the 2010 health care law.

“The Obama-era guidance was very powerful and very helpful,” said Peterson. “The Trump administration can try to undo it, but the courts are sticking with” the interpretation that it is discrimination.