For indispensable reporting on the coronavirus crisis, the election, and more, subscribe to the Mother Jones Daily newsletter.

The Trump administration’s “conscience rule,” which would have allowed health care providers to refuse to offer services such as abortions, contraceptive care, and vaccinations that they disagree with on religious or moral grounds, was declared unconstitutional by a federal judge on Wednesday.

The rule, which was set to go into effect later this month, was voided by US District Court Judge Paul Engelmayer in Manhattan. In a 147-page opinion, Engelmayer stated that the administration did not have the authority to enact major portions of the rule change and that several parts of the Department of Health and Human Services’ argument in favor of the change were factually inaccurate.

Had the rule, also known as the refusal-of-care rule, gone into effect, it would have enabled providers, pharmacists, and potentially employers to deny health care services, information, or referrals to patients on moral or religious grounds, even in emergencies. Hospitals that forced their employees to provide care over their personal objections would have been subject to penalties such as losing federal funding. The rule would also have allowed providers to decline to refer a patient to another provider in order to receive care based on personal objections to the service.

The lawsuit that resulted in Wednesday’s ruling was brought by New York Attorney General Letitia James, nearly two dozen other states and cities, and two reproductive rights groups. “Once again, the courts have blocked the Trump administration from implementing a discriminatory rule that would only hurt Americans,” James said in a statement following the ruling. “The refusal of care rule was an unlawful attempt to allow health care providers to openly discriminate.”

Critics of the the rule argued that it would disproportionately affect the LGBTQ population by giving further protection to providers to deny care to patients based on their identities.

“Today, the Trump administration was blocked from providing legal cover for discrimination,” Alexis McGill, acting president and CEO of Planned Parenthood, said in a statement. “As the federal district court made clear, the administration acted outside its authority and made false claims to try to justify this rule. This rule put patients’ needs last and threatened their ability to access potentially lifesaving health care.”