A divided Supreme Court ruled 5-4 on Monday that closely held corporations cannot be required to provide contraception coverage for their employees.

In an opinion authored by Justice Samuel Alito, the court ruled in Burwell v. Hobby Lobby Stores and Conestoga Wood Specialties v. Burwell that the Obama administration has failed to show that the contraception mandate contained in the Affordable Care Act is the "least restrictive means of advancing its interest" in providing birth control at no cost to women.

"Any suggestion that for-profit corporations are incapable of exercising religion because their purpose is simply to make money flies in the face of modern corporate law," Alito wrote, adding that by requiring religious corporations to cover contraception, "the HHS mandate demands that they engage in conduct that seriously violates their religious beliefs."

The Affordable Care Act contains a provision requiring most employers to cover the full range of contraception in their health care plans at no cost to their female employees. The Obama administration had granted an exemption for churches and accommodations for religious hospitals, schools and nonprofits, but for-profit companies were required to comply with the coverage rule or pay fines.

Hobby Lobby, a Christian-owned craft supply chain store, and Conestoga Wood Specialties Store, a Pennsylvania wood manufacturer owned by a family of Mennonites, challenged the contraception mandate on the grounds that it violates their religious freedom by requiring them to pay for methods of contraception they find morally objectionable. The owners of those companies believe some forms of birth control -- emergency contraception and intrauterine devices -- are forms of abortion because they could prevent a fertilized egg from implanting in the uterus.

Monday's opinion was written narrowly so as only to apply to the contraception mandate, not to religious employers who object to other medical services, like blood transfusions or vaccines.

Justices Ruth Bader Ginsburg filed a dissenting opinion joined by Justice Sonia Sotomayor and mostly joined by Justices Elena Kagan and Stephen Breyer. Ginsburg warned in her dissent that the decision was not as narrow as it claimed to be. "In a decision of startling breadth, the Court holds that commercial enterprises, including corporations, along with partnerships and sole proprietorships, can opt out of any law (saving only tax laws) they judge incompatible with their sincerely held religious beliefs," Ginsburg wrote.

Ginsburg argued that the government has a "compelling interest" in providing no-cost birth control to women. "Those interests are concrete, specific, and demonstrated by a wealth of empirical evidence," she wrote. "To recapitulate, the mandated contraception coverage enables women to avoid the health problems unintended pregnancies may visit on them and their children."

"President Obama believes that women should make personal health care decisions for themselves rather than their bosses deciding for them. Today’s decision jeopardizes the health of women that are employed by these companies."

"We will, of course, respect the Supreme Court ruling," White House press secretary Josh Earnest said Monday, adding that the administration will "consider the range of options available to the president."

Earnest also called on Congress to make sure the women affected still have contraception coverage. "Congress needs to take action to solve this problem that has been created," he said.

At oral arguments in March, the women Supreme Court justices grilled Hobby Lobby's lawyer, former Solicitor General Paul D. Clement, about whether a for-profit company can be considered a religious organization, exempt from certain federal laws, if a majority of its employees hold different beliefs than the company's owners. Justices Sotomayor and Kagan asked whether companies like Hobby Lobby should be allowed to refuse to cover procedures like blood transfusions and vaccines, or to ask for exemptions to things like anti-discrimination and minimum wage laws, if they had religious objections to those policies.

"Everything would be piecemeal, nothing would be uniform," Kagan warned.

But some of the court's conservative-leaning justices asked why the Obama administration had granted religious accommodations to any organizations if the contraception mandate was so critical to public health. "It must have been because the health care coverage was not that important," said Justice Anthony Kennedy, who was generally considered to be the swing vote.

In his concurring opinion, Kennedy said the decision "does not have the breadth and sweep ascribed to it by the respectful and powerful dissent." He said because there is already a mechanism in place to provide a religious accommodation to some organizations, adding another accommodation would not be a significant burden on the government

"In these cases, it is the Court's understanding that an accommodation may be made to the employers without imposition of a whole new program or burden on the government," Kennedy wrote. "As the Court makes clear, this is not a case where it can be established that it is difficult to accommodate the government's interest, and in fact the mechanism for doing so is already in place.

Ginsburg's dissent said that Congress had never intended to allow for-profit corporations to get religious-based exemptions, arguing that if it had, "a clarion statement to that effect likely would have been made in the legislation."

Cecile Richards, president of the Planned Parenthood Action Fund, called the decision a blow to women's reproductive health.

“Today, the Supreme Court ruled against American women and families, giving bosses the right to discriminate against women and deny their employees access to birth control coverage," Richards said in a statement. "This is a deeply disappointing and troubling ruling that will prevent some women, especially those working hourly-wage jobs and struggling to make ends meet, from getting birth control."

Read the opinion here.