OAKLAND, Calif. (CN) – A federal judge on Thursday temporarily halted new rules by the Trump administration to let employers or insurers opt out of contraception coverage in their health care plans on religious and moral grounds.

In granting a nationwide preliminary injunction immediately enjoining the rules, U.S. District Judge Haywood Gilliam Jr. found the plaintiffs – attorneys general from five states – would likely prove the administration violated the Administrative Procedure Act by issuing the rules without advance notice and comment, and that the violation would cause them imminent social and fiscal harm.

“[F]or a substantial number of women, the 2017 IFRs [interim final rules] transform contraceptive coverage from a legal entitlement to an essentially gratuitous benefit wholly subject to their employer’s discretion,” Gilliam wrote in a 29-page order. “The impact on the rules governing the health insurance coverage of plaintiffs’ citizens – and the stability of that coverage – was immediate, which also implicates plaintiffs’ fiscal interests as described above.”

Gilliam’s ruling comes a week after a federal judge in Pennsylvania granted an identical injunction in a similar case brought by Pennsylvania Attorney General Josh Shapiro in October.

California Attorney General Xavier Becerra applauded Thursday’s ruling in a statement.

“The law couldn’t be more clear: a woman, not her boss and certainly not a politician, should decide what’s best for her own health care,” he said. “The Affordable Care Act guarantees that women are not burdened with high costs for seeking basic health care, including birth control. This court ruling serves as yet another reminder to the Trump administration: the rule of law applies to everyone, no matter who you are or how high your rank.”

The Affordable Care Act requires employers to offer health insurance that covers birth control with no co-payment. Houses of worship were granted an exemption to the mandate, while nonprofits were allowed to opt out via an “accommodation” by which an employer certified its objection to the mandate to the federal government. The government was then tasked with confirming that insurers provided separate coverage.

But the Trump administration issued new rules in October to let any employer or health insurer with religious or moral objections opt out of the health law’s contraceptive-coverage requirement. Under the rules, exempted entities no longer had to certify their objection or otherwise notify the government of their decision to stop providing coverage.

Siding with the states on Thursday, Gilliam found that the rules would in fact harm them because they would have to pay for contraception and unplanned pregnancies if the rules remained place.

“The injury asserted is directly traceable to defendants’ decision to issue the IFRs without advance notice and comment, and granting a preliminary injunction would enjoin enforcement of those IFRs until the court can assess the merits,” he concluded.

He also found the administration wasn’t justified in forgoing notice and comment on the rules, which would have allowed the plaintiffs and other members of the public to provide input before they took effect.

The administration’s lawyers had argued that forgoing public comment was justified because, among other reasons, it could more quickly resolve multiple pending lawsuits challenging the contraceptive mandate, and “provide immediate resolution” to groups that objected to it for religious reasons. But the government’s justifications didn’t satisfy the Administrative Procedure Act’s good-cause exception, Gilliam said.

“Defendants make no argument that the above considerations made it impossible for them to both satisfy the notice and comment requirement and execute their statutory duties under the ACA. “Defendants also fail to establish (or even claim) that notice and comment would have effectively prevented them from operating,” he wrote.

“If ‘good cause’ could be satisfied by an agency’s assertion that ‘normal procedures were not followed because of the need to provide immediate guidance and information … then an exception to the notice requirement would be created that would swallow the rule,'” he concluded, quoting from Zhang v. Slattery, decided by the Second Circuit in 1995.

In a statement, Justice Department spokeswoman Lauren Ehrsam said the Trump administration disagrees with the ruling.

“This administration is committed to defending the religious liberty of all Americans and we look forward to doing so in court,” Ehrsam said.

Gilliam’s ruling on whether to allow the Little Sisters of the Poor, a religious nonprofit operated by an order of Catholic nuns, to intervene is still pending.

The Little Sisters previously won an injunction in the Supreme Court, in Zubik v. Burwell, which they say is threatened by the states’ lawsuit. The 2016 injunction bars the federal government from imposing fines on religious nonprofits for failing to comply with the contraception mandate, saving the Little Sisters $3 million in annual fines, according to their court brief.

But Gilliam said the Zubik injunction would remain intact under his injunction. He ordered the administration to proceed under the framework in place prior to the Oct. 6 rules pending resolution of the case.

While the Affordable Care Act lets religious groups opt out of the contraception mandate, the plaintiffs in Zubik – a group of religious nonprofits – said the law’s framework still made them complicit in contraception use by forcing them to facilitate contraception coverage through their health plans.

Zubik was one of eight cases the Supreme Court took up from four circuit courts, all of which found that the contraception mandate serves a compelling government interest while giving religious groups an acceptable way out.

California Justice Department attorney Julie Weng-Gutierrez represents the plaintiffs, and U.S. Justice Department attorney Ethan Davis represents the administration.