A federal judge on Friday temporarily blocked a Trump administration rule that allows virtually any business to cite religious or moral objections and opt out of a federal requirement that they cover contraception as part of employee health plans.

In a 44-page opinion, U.S. District Judge Wendy Beetlestone in Philadelphia sided with the plaintiff, the state of Pennsylvania, which argued that the rule was harmful to working women and would force the state to shoulder the costs of their birth control and unplanned pregnancies.

“The Commonwealth’s concern is . . . women will either forgo contraception entirely or choose cheaper but less effective methods — individual choices which will result in an increase in unintended pregnancies,” Beetlestone wrote, calling the potential harm to women there and nationwide “enormous and irreversible.”

She detailed how the rule could play out. “It would allow an employer with a sincerely held moral conviction that women do not have a place in the workplace to simply stop providing contraceptive coverage,” she wrote. “It is difficult to comprehend a rule that does more to undermine the Contraceptive Mandate or that intrudes more into the lives of women.”

The ruling stems from a long-running legal and political conflict over a provision of the Affordable Care Act, the health-care law passed under President Barack Obama, requiring most employers to cover as part of their workers' health plans any birth control approved by the Food and Drug Administration, without a co-pay.

Reproductive-rights advocates cheered the rule, saying it recognizes birth control is integral to women’s health care and critical to their ability to control their futures.

Some religious groups objected to the rule because of their opposition to certain forms of birth control, particularly intrauterine devices and the morning-after pill. Both, they say, are akin to abortion because they may halt a pregnancy after an egg has been fertilized.

In 2014, the Supreme Court ruled that certain closely held corporations with religious objections could opt out of the contraception mandate. Many entities still had objections, and the Trump administration announced in October that it would give organizations and businesses a broad right to opt out.

Religious-liberty groups, which have lauded President Trump’s efforts to protect people of faith, said they were confident the latest judicial ruling would not withstand scrutiny by other courts.

“We are confident that the appeals court or the Supreme Court will overturn this ruling and ensure that the government can do the right thing and continue to protect religious groups,” Lori Windham, senior counsel at the Becket Fund for Religious Liberty, said in a statement.

But Beetlestone’s ruling was applauded by lawmakers and other officials who oppose Trump’s efforts to dismantle the ACA and hard-won victories on issues of reproductive rights.

“Today is a critical victory for millions of women and families and for the rule of law,” said Josh Shapiro, attorney general of Pennsylvania, one of the several states challenging the Trump administration rule. “The harm from this rule was immediate. Women need contraception for their health because contraception is health care, pure and simple.”

Women's advocacy groups also praised the decision as a victory, at least in the short term. Multiple cases are still moving through the court system, and it is likely that the administration will appeal Friday's outcome.

"A nationwide injunction is a really great step for women across the country, who now know at least for a while they can take a breath and know their birth control coverage isn't going anywhere," said Mara Gandal-Powers, senior counsel for the National Women's Law Center.