WASHINGTON — The Supreme Court says corporations can hold religious objections that allow them to opt out of the new health law requirement that they cover contraceptives for women.

The justices’ 5-4 decision Monday is the first time that the high court has ruled that profit-seeking businesses can hold religious views under federal law. And it means the Obama administration must search for a different way of providing free contraception to women who are covered under objecting companies’ health insurance plans.

Contraception is among a range of preventive services that must be provided at no extra charge under the health care law that President Barack Obama signed in 2010 and the Supreme Court upheld two years later.

Two years ago, Chief Justice John Roberts cast the pivotal vote that saved the health care law in the midst of Obama’s campaign for re-election.

On Monday, dealing with a small sliver of the law, Roberts sided with the four justices who would have struck down the law in its entirety.

Justice Samuel Alito wrote the majority opinion. The court’s four liberal justices dissented.

The court stressed that its ruling applies only to corporations that are under the control of just a few people in which there is no essential difference between the business and its owners.

Alito also said the decision is limited to contraceptives under the health care law. “Our decision should not be understood to hold that an insurance-coverage mandate must necessarily fall if it conflicts with an employer’s religious beliefs,” Alito said.

The administration said a victory for the companies would prevent women who work for them from making decisions about birth control based on what’s best for their health, not whether they can afford it. The government’s supporters pointed to research showing that nearly one-third of women would change their contraceptive if cost were not an issue; a very effective means of birth control, the intrauterine device, can cost up to $1,000.

The contraceptives at issue before the court were the emergency contraceptives Plan B and ella, and two IUDs.

Nearly 50 businesses have sued over covering contraceptives. Some, like those involved in the Supreme Court case, are willing to cover most methods of contraception, as long as they can exclude drugs or devices that the government says may work after an egg has been fertilized. Other companies object to paying for any form of birth control.

There are separate lawsuits challenging the contraception provision from religiously affiliated hospitals, colleges and charities.

A survey by the Kaiser Family Foundation found 85 percent of large American employers already had offered such coverage before the health care law required it.

It is unclear how many women potentially are affected by the high court ruling. The Hobby Lobby chain of arts-and-crafts stores is by far the largest employer of any company that has gone to court to fight the birth control provision.

Oklahoma City-based Hobby Lobby has more than 15,000 full-time employees in more than 600 crafts stores in 41 states. The Greens are evangelical Christians who also own Mardel, a Christian bookstore chain.

The other company is Conestoga Wood Specialties Corp. of East Earl, Pa., owned by a Mennonite family and employing 950 people in making wood cabinets.