The U.S. Supreme Court sided with the Trump administration Wednesday in its effort to allow more employers to opt out of providing no-cost birth control to women as required by the Affordable Care Act.

The high court on Wednesday voted 7-2 the administration acted properly when it allowed more employers who cite a religious or moral objection to opt out of covering birth control. The ruling came in the case of “Little Sisters of the Poor v. Pennsylvania.”

“We hold today that the Departments had the statutory authority to craft that exemption, as well as the contemporaneously issued moral exemption. We further hold that the rules promulgating these exemptions are free from procedural defects,” Justice Clarence Thomas wrote.

During the Obama administration, the Department of Health and Human Services provided an accommodation for religious non-profit employers who informed the government of their objection to contraception, giving employees access to contraception without the religious group’s involvement.

Accepting the argument by religious groups that merely applying for an exemption placed a “substantial burden” on religious freedom, the Trump administration made participation in the accommodation process voluntary.

Pennsylvania and New Jersey sued, and federal courts ruled the administration’s expanded accommodation failed to follow the procedure mandated by law.

»MORE: Supreme Court Justice John Roberts briefly hospitalized in June

Recent court decisions had ruled in favor of religious employers and private companies that claimed an exemption based on their religion, including the Hobby Lobby chain of craft stores.

But the court has also upheld an Obama administration accommodation under which the health insurers would step in and provide contraceptives for female workers. The insurers agreed to do so because providing birth control would cost less than paying for a pregnancy and delivery.

Religious conservatives objected to that approach because it would make them "complicit in sin" if their insurers were involved in providing the contraceptives, according to the Los Angeles Times.

The Trump administration proposed a broader rule to cover more employers and exempt them entirely from the Obamacare regulation.