The Trump administration had legal authority to allow private employers with moral or religious objections to opt out of providing birth control health insurance required under the Affordable Care Act, the U.S. Supreme Court ruled on Wednesday.

“We hold today that the departments had the statutory authority to craft that [religious] exemption, as well as the contemporaneously issued moral exemption,” Justice Clarence Thomas wrote for a 7-2 majority. “We further hold that the rules promulgating these exemptions are free from procedural defects.”