SAN FRANCISCO (CN) – A federal judge blocked a Trump administration “conscience rule” late Tuesday that would have expanded protections for health care workers with religious objections to certain medical procedures, just two days before it was set to take effect.

Under the rule introduced by the Department of Health and Human Services this past May, hospital workers could refuse to provide medical services that conflict with their religious beliefs, including providing birth control or assisting with procedures like abortion or sterilization.

California, San Francisco, Santa Clara and various health care and advocacy groups sued prevent the rule from being implemented, claiming their failure to comply would jeopardize billions in federal funding.

Since it also requires accommodations for file clerks who schedule surgeries, employees who prepare rooms or sterilize equipment and paramedics who drive patients to hospitals, the plaintiffs claim the rule will burden hospitals and clinics by forcing them to hire more staff, resulting in delayed or inferior care for patients.

The rule expands decades of conscience-based federal statutes designed to protect workers’ religious rights, like the Church Amendment enacted in the 1970s to bar federally funded entities from requiring doctors and nurses with religious objections to perform abortions or sterilizations. In 2004, the Weldon Amendment ensured that health insurance plans that refused to cover abortions would not lose federal funds.

But U.S. District Judge William Alsup said the latest rule broadens protections “beyond what Congress intended and will hamstring the delivery of health care.”

In his ruling, Alsup cited an example raised at a hearing last month by a lawyer for the city of San Francisco suggesting an ambulance driver could actually expel a patient en route to a hospital for an emergency abortion.

“Such harsh treatment would be blessed by the new rule,” Alsup said. “Although this order does not accept all of plaintiffs’ criticisms, this order holds that the new rule conflicts with those statutes in a number of ways and upsets the balance drawn by Congress between protecting conscientious objections versus protecting the uninterrupted effective flow of health care to Americans.”

Alsup said the HHS went too far in promulgating the rule, which none of the current statutes grant it authority to do.

“HHS, of course, has rule-making authority to implement the ACA and Medicare and Medicaid programs as well as the applicable conscience provisions,” Also wrote. “But HHS does not have rule-making authority to change, add to, or subtract from conscience provisions in other statutes such as the Church and Weldon amendments.”

He added, “True, any and all agencies must interpret the statutes under their care. But if their interpretations are wrong, then a court must set them aside. This order also holds that while HHS may interpret the statutes in question, those interpretations may not add to or subtract from what the statutes themselves say. This order further holds that the rule in question does exactly that by adding expansive definitions in conflict with the statutes and imposing draconian financial penalties.”

Alsup thus vacated the rule in its entirety. It was originally set to go into effect on July 22, but the Trump administration agreed to delay it until Nov. 22. Alsup’s ruling follows two weeks after a federal judge in New York struck down the rule in a strongly worded decision that called its necessity into question.

In a statement, San Francisco City Attorney Dennis Herrera called the decision a victory for patients’ rights.

“Discriminatory regulations cannot be allowed to threaten patient health. No one should have to fear being denied critical medical service in their time of need. In particular, this rule targeted women, LGBTQ communities and other vulnerable patients, but it would have put anyone in an emergency situation at risk. We’re not about to let the Trump administration jeopardize public health and safety with this unconscionable rule.”