A federal judge in Texas ruled on Friday that President Joe Biden's administration had wrongly interpreted an Obamacare provision as barring health care providers from discriminating against gay and transgender people.

U.S. District Judge Matthew Kacsmaryk in Amarillo ruled that a landmark U.S. Supreme Court decision in 2020 holding that a law barring workplace discrimination protects gay and transgender employees did not apply to the healthcare law.

The ruling by Kacsmaryk, an appointee of former Republican President Donald Trump, came in a class action lawsuit by two doctors represented by the America First Legal Foundation, set up by former Trump White House adviser Stephen Miller.

BIDEN FACES BACKLASH AFTER INTERVIEW WITH TRANS ACTIVIST ON GENDER-AFFIRMING CARE: 'INAPPROPRIATE'

They sued after the U.S. Department of Health and Human Services said in May 2021 it would interpret Section 1557 of the Affordable Care Act, which bars healthcare providers from discriminating on the basis of sex, as extending to sexual orientation and gender identity.

Kacsmaryk said Congress, when adopting the law, known as Obamacare, in 2010, during the tenure of former Democratic President Barack Obama, could have included "sexual orientation" or "gender identity" in the text, but "chose not to do so."

Texas breaking news photo

U.S. District Judge Matthew Kacsmaryk of Texas sued after the U.S. Department of Health and Human Services said it would interpret an anti-discrimination provision to include sexual orientation and gender identity.

Instead, the law incorporated the bar against discrimination "on the basis of sex" in Title IX, a 50-year-old federal civil rights law that bars such discrimination in education programs.

Kacsmaryk said the logic of the Supreme Court's 6-3 conclusion that Title VII's bar against sex discrimination covered gay and transgender workers did not lead to the same result under Title IX's text.

GEORGETOWN UNIVERSITY'S MED SCHOOL PROMOTES PUBERTY BLOCKERS, CROSS-SEX HORMONES FOR MINORS: REPORT

"Title IX's ordinary public meaning remains intact until changed by Congress, or perhaps the Supreme Court," Kacsmaryk wrote.

HHS and the plaintiffs' lawyers did not immediately respond to requests for comment.

CLICK HERE TO GET THE FOX NEWS APP

The Obama administration introduced rules in 2016 that made clear that LGBT people would be protected under the healthcare discrimination provision.

But those protections were reversed by a Trump-era rule finalized in 2020. In June, the Biden administration proposed a rule to once again enshrine such protections.