A federal judge in Texas has put the kibosh on Obama administration protections for some anti-discrimination rules of the Affordable Care Act (ACA), just a day before they were to take effect.

US District Judge Reed O'Connor issued a temporary nationwide injunction December 31 against a rule adopted by the US Health and Human Services Department that forbids discrimination in the ACA (also known as Obamacare) on the basis of "gender identity" and "termination of pregnancy."

The HHS rule incorporates abortion and transgender health services into the original 2010 ACA clause intended to bar insurers from denying coverage to or charging individuals more based on sex or age.

In his ruling, O'Connor sided with eight states, including Texas, and three Christian healthcare groups that have brought lawsuits challenging the rule because, as he explained, the "interpretation of sex discrimination pressures doctors to deliver healthcare in a manner that violates their religious freedom and thwarts their independent medical judgment…."

He found that plaintiffs were likely to win court claims that the rule infringes on the rights of private healthcare providers under the Religious Freedom Restoration Act, as he said the rule would "require them to perform and provide insurance coverage for gender transitions and abortions, regardless of their contrary religious beliefs or medical judgment."

The new policy would have violated the Administrative Procedure Act, which governs rule-making procedures, the judge also ruled, according to Reuters.

Advocates disagree, saying it is unlikely anyone would seek an abortion or gender transition surgery from someone lacking experience or will.

"Judge O'Connor's conclusion that transgender people and persons who have had abortions are somehow excepted from protection is deeply troubling, legally specious, and morally repugnant," Ezra Young, director of impact litigation at the Transgender Legal Defense & Education Fund, told the Detroit News.

HHS spokesperson Marjorie Connolly told Buzzfeed News, "We are disappointed by the court's decision to preliminarily enjoin certain important protections against unlawful sex discrimination in our health care system. Section 1557 of the Affordable Care Act is critical to ensuring that individuals, including some of our most vulnerable populations, do not suffer discrimination in the health care and health coverage they receive."

However, other protections covering race, disability, national origin and limited English proficiency, among others, remain in the ACA and will continue to be enforced, she noted.

White House spokeswoman Katie Hill called the injunction a setback.

"Today's decision is a setback, but hopefully a temporary one, since all Americans — regardless of their sex or sexual orientation — should have access to quality, affordable health care free from discrimination," she said, Reuters reports.

The incoming administration of Donald Trump is expected to be hostile to protections for reproductive and transgender health. The president-elect and many of his top advisers have declared themselves "pro-life."

Texas has challenged a number of provisions of the ACA, as have other states. So far, US Supreme Court rulings in 2012 and 2015 have kept the law intact, Reuters points out.