A federal judge has struck down parts of a federal law that protects transgender patients.

Judge Reed O’Connor in the Northern District of Texas ruled yesterday that protections for transgender patients in the Affordable Care Act (ACA, also known as ObamaCare) violate the religious freedom of health care providers.

Related: Trump will rescind transgender health care protections

The ruling concerns part of the ACA that bans discrimination on the basis of sex on the part of any health care provider who receives federal funding. The Obama administration interpreted this to mean that health care providers are required to provide “medically necessary” treatment to transgender people and women who have previously had an abortion, if they provide the same medical procedure to other patients.

Five states and a group of Christian health care providers called the Franciscan Alliance sued in 2016 to overturn the rule, saying that it would force them to provide gender affirmation health care and force insurers to pay for abortions.

Judge O’Connor issued a nationwide injunction against the rule in 2016, meaning that it was not stricken down but that it could not be enforced while the case was being heard. Then, yesterday, he struck down the rule.

“His ruling today is far from the last word on Section 1557,” transgender rights activists pointed out. “The ruling firmly places Judge O’Connor’s court and the Trump administration on the fringe of the legal establishment, particularly when combined with his odd ruling against the entire Affordable Care Act,” Gillian Branstetter of the National Center for Transgender Equality told The Advocate.

Branstetter said that even though the Obama administration’s interpretation has been struck down, federal courts can still rule that the ban on sex discrimination includes anti-trans discrimination.

“The ruling does not, however, change the fact that transgender people remain covered under Section 1557 – as read by literally every other federal court – nor does it erase the tens of thousands of comments defending the 2016 rule on both moral, legal, and public health grounds.”

The Obama administration defended the rule, but the Trump administration declined to, saying that they wanted to rewrite transgender protections out of the rule.

The River City Gender Alliance and the ACLU stepped in to defend it, and they can appeal O’Connor’s ruling.

In a separate ruling last year, O’Connor struck down the entire ACA. That decision is currently being appealed.

He has also ruled against Obama era protections for transgender students and found that the Family and Medical Leave Act does not include same-sex spouses. The latter ruling was overturned on appeal.

Judge O’Connor was appointed to the federal bench by former president George W. Bush, who was in the news last week for his friendship with daytime talk show host Ellen Degeneres.