In the waning hours of 2016, U.S. District Judge Reed O’Connor unleashed a bizarre ruling that fundamentally alters the balance between medical treatment and religious freedom in the United States. O’Connor’s decision blocked a critical regulation enacted pursuant to the Affordable Care Act, which forbade doctors from discriminating against transgender patients or women who’ve previously had abortions. Most disturbingly, O’Connor found that such a nondiscrimination rule violated the “religious freedom” of doctors and insurance companies that consider gender transition and abortion to be “evil.” The ruling marks an extreme extension of the dubious logic behind the Supreme Court’s Burwell v. Hobby Lobby decision—and indicates that conservative courts believe the purported right of health care professionals to discriminate against patients trumps patients’ right to sound medical treatment.

Some background: The ACA bars discrimination in health care on the basis of sex, which the Department of Health and Human Services has interpreted to include “gender identity” and “termination of pregnancy.” As many federal courts and agencies have concluded, “sex discrimination” is a somewhat ambiguous concept that can be read to include sex stereotyping and sex-based considerations. Anti-trans discrimination is clearly sex stereotyping, while discrimination against women who terminated a pregnancy is rooted in stereotypes about maternity and female sexuality. HHS’ rule thus filled a standard statutory gap and should have received judicial deference.

But O’Connor recognizes only one kind of sex discrimination: hostility against a man or woman for being a man or a woman. This belief directly contradicts Supreme Court authority; it also doesn’t make much sense, since it only raises the key question of who decides whether an individual is a man or a woman. (Is discrimination against an intersex person not sex discrimination? What about a person with ambiguous genitalia who identifies as male?) Still, O’Connor got away with this blinkered understanding of sex in blocking federal guidelines on bathroom access for transgender students. And naturally he pulled the same trick here, holding that the HHS rule does not build upon “sex discrimination” and is therefore unlawful.

So far, so predictable. Texas, which brought this suit along with four other states and several Christian medical associations, chose O’Connor’s court specifically because of his clear opposition to federal rules protecting transgender people. A simple ruling on sex discrimination, coupled with a nationwide injunction forbidding the HHS regulation from taking effect, could’ve ended the matter. But O’Connor—despite having already resolved the dispute—decided to go much further, analyzing the case under the federal Religious Freedom Restoration Act, or RFRA.

You’ll recall RFRA from Hobby Lobby: It’s the statute designed to protect religious minorities against laws that restrict their free exercise rights, which has now been read to protect businesses against nondiscrimination laws. Ever since the Hobby Lobby decision, progressives have warned that RFRA poses a grave threat to LGBTQ rights, fearing that businesses can use it to circumvent nondiscrimination laws shielding LGBTQ people.

That fear is now an undeniable reality. O’Connor held that treating transgender patients—and even insuring transgender patients—“substantially burdens” insurance companies and hospitals’ “exercise of religion.” As a result, under RFRA, the HHS rule must be “the least restrictive means of furthering [a] compelling government interest.” O’Connor decided that the rule did not constitute “the least restrictive means” of preventing discrimination. Why not? Because “the government [can] assume the cost” of transgender-related treatment, and “assist transgender individuals in finding” a doctor who will treat them. The judge then goes on to suggest that protecting transgender people from discrimination isn’t actually a “compelling government interest” in the first place.

And what about those abortion-related protections? O’Connor blocked those too, holding that RFRA also protects doctors and insurance companies from providing or covering “abortion-related services.” The judge may be right about that, but it really doesn’t matter, because the rule in question does not require anybody to perform or insure abortions. As Timothy Jost explains in Health Affairs, “Judge O’Connor is simply wrong in believing that [the rule] requires anyone to pay for or perform abortions.” In reality, the rule prohibits doctors and insurance companies from discriminating against women who have had abortions in the past. With his decision, then, O’Connor provides a neat template for future judges irritated by nondiscrimination statutes: Make up a version of the law that isn’t real, then strike down the real law based on your made-up version of it.

Ultimately, the most distressing aspect of O’Connor’s ruling isn’t his judicial chicanery regarding facts and precedent—in O’Connor’s court, that’s par for the course—but his wild expansion of Hobby Lobby. The Christian medical associations and insurance companies behind this lawsuit argued that treating transgender patients and women who’ve had abortions constituted “material cooperation with evil.” O’Connor agreed, and he decided that the law should value these beliefs over everyone else’s right to receive medical treatment. The ramifications of this reasoning are chilling, especially for women and LGBTQ people. Does RFRA bar the government from protecting gay people against medical discrimination? What about women who don’t wish to become pregnant?

Under O’Connor’s logic, the answer to both questions is surely yes. Indeed, by the terms of his ruling, the government can’t require doctors and insurance companies to treat or cover anything they believe to be “evil.” Instead, the government must continually step in to insure unpopular patients and help them find a doctor who will deign to treat them. This system would completely upend medical practice in the United States, legalizing prejudice-based refusal of service and placing the burden on patients to find a doctor and insurance company who will provide the treatment they need. There is no clear limit to the damage that O’Connor’s ruling could do. It appears that in our post–Hobby Lobby world, patients who draw ire from conservative Christians must get used to being deprived of insurance and denied medical treatment solely on account of their identities.