(Reuters) - A judge in California on Sunday partially blocked a set of Trump administration rules that allow employers to opt out of providing health insurance that covers women’s birth control from taking effect.

U.S. District Judge Haywood Gilliam in Oakland granted a request by 14 Democratic attorneys general for a preliminary injunction. The rules, which are set to go into effect Jan. 14, allow businesses or nonprofits to obtain exemptions to an Obamacare requirement for contraceptive coverage on moral or religious grounds.

Led by California Attorney General Xavier Becerra, the attorneys general had asked for a nationwide injunction, but Gilliam limited his ruling to the states challenging the rules.

Gilliam did not reach a final decision in the case, but said the rules likely violated federal law.

The states involved also include Connecticut, Delaware, Hawaii, Illinois, Maryland, Minnesota, New York, North Carolina, Rhode Island, Vermont, Washington, Virginia, and the District of Columbia.

“Today’s court ruling stops another attempt by the Trump Administration to trample on women’s access to basic reproductive care,” Becerra said in a statement.

A spokeswoman for the U.S. Department of Justice, which has defended the rules in court, did not immediately respond to a request for comment.

The Affordable Care Act of 2010, popularly known as Obamacare, required employers to cover contraception under their health plans with no co-payment but created exemptions for religious houses of worship.

In October 2017 the Trump administration said it would broaden the existing exemptions and added “moral conviction” as a basis for opting out of providing birth control.

Conservative Christian activists and congressional Republicans praised the move, while reproductive rights advocates and Democrats criticized it.

The attorneys general sued soon after the rules were announced, saying they were invalid under a law governing how regulations can be implemented.

Gilliam said on Sunday that the attorneys general had legal standing to file the lawsuit because the rules would cause them economic harm.

State governments would be forced to provide additional birth control coverage and pay health care costs associated with a rise in unintended pregnancies, the judge said.

Gilliam said the “moral convictions” exemption created by the Trump administration did not implicate the Constitution’s protections for religious liberty and was “inconsistent with the language and purpose of” Obamacare.

Gilliam had previously blocked an interim version of the rules. An appeals court upheld that injunction, but limited it to the states involved in the case.