(NBC News) - The U.S. Supreme Court ruled Monday that, in limited cases, for-profit companies can claim a religious exemption to the Obamacare requirement that they provide health insurance coverage for contraceptives.

For-profit corporations — including Conestoga Wood of Pennsylvania, owned by a family of Mennonite Christians, and Hobby Lobby, a family-owned chain of arts and crafts stores founded on Biblical principles — challenged a provision of the Affordable Care Act.

It requires companies with more than 50 employees to cover preventive care services, which include such contraceptives as morning-after pills, diaphragms and IUDs.

The court’s ruling Monday was 5-4, and the decision appeared to be extremely limited. It did not appear to open the door to other types of religious-exemption claims by companies.

The companies said that the use of some contraceptives is the equivalent of abortion, destroying a human life by interfering with a fertilized egg. For that reason, they said, providing the coverage would violate their religious beliefs.

A principle issue for the Supreme Court was whether a for-profit corporation can claim that its religious freedom allows it to be exempt from a law.

The Obama administration argued that the freedom of religion applies only to the company owners individually, not to the for-profit corporations they run. It's the the corporations, not the family members themselves, who are required to provide insurance coverage for contraceptives under Obamacare, the government said.

The companies were among more than three dozen for-profit corporations that challenged the contraceptive mandate in federal courthouses nationwide. Hobby Lobby prevailed in the lower courts, but Conestoga Wood lost its claim.

The companies relied not only on the Constitutionbut also on a federal law, the Religious Freedom Restoration Act, which says the federal government cannot "substantially burden a person's exercise of religion," even if the burden results from a general law intended to apply to everyone.