The Supreme Court on Thursday blocked the Biden administration from enforcing its sweeping vaccine-or-test requirements for large private companies, but allowed a vaccine mandate to stand for medical facilities that take Medicare or Medicaid payments.

The rulings came three days after the Occupational Safety and Health Administration’s emergency measure started to take effect.

That mandate required that workers at businesses with 100 or more employees must get vaccinated or submit a negative Covid test weekly to enter the workplace. It also required unvaccinated workers to wear masks indoors at work.

“Although Congress has indisputably given OSHA the power to regulate occupational dangers, it has not given that agency the power to regulate public health more broadly,” the court wrote in an unsigned opinion.

“Requiring the vaccination of 84 million Americans, selected simply because they work for employers with more than 100 employees, certainly falls in the latter category,” the court wrote.

A demonstrator holds a "Freedoms & Mandates Don't Mix" sign outside the U.S. Supreme Court during arguments on two federal coronavirus vaccine mandate measures in Washington, D.C., U.S., on Friday, Jan. 7, 2022.A demonstrator holds a “Freedoms & Mandates Don’t Mix” sign outside the U.S. Supreme Court during arguments on two federal coronavirus vaccine mandate measures in Washington, D.C., U.S., on Friday, Jan. 7, 2022.

Liberal Justices Stephen Breyer, Sonia Sotomayor and Elena Kagan dissented, writing that the majority has usurped the power of Congress, the president and OSHA without legal basis.

“In the face of a still-raging pandemic, this Court tells the agency charged with protecting worker safety that it may not do so in all the workplaces needed,” they said in their dissent.

“As disease and death continue to mount, this Court tells the agency that it cannot respond in the most effective way possible. Without legal basis, the Court usurps a decision that rightfully belongs to others. It undercuts the capacity of the responsible federal officials, acting well within the scope of their authority, to protect American workers from grave danger,” they wrote.

In a separate, simultaneously released ruling on the administration’s vaccination rules for health-care workers, a 5-4 majority sided with the Biden administration.

“We agree with the Government that the [Health and Human Services] Secretary’s rule falls within the authorities that Congress has conferred upon him,” said the majority, writing that the rule “fits neatly within the language of the statute.”

“After all, ensuring that providers take steps to avoid transmitting a dangerous virus to their patients is consistent with the fundamental principle of the medical profession: first, do no harm,” the majority opinion read.

Justices Clarence Thomas, Samuel Alito, Neil Gorsuch and Amy Coney Barrett, four of the six conservatives on the nine-seat bench, dissented.

“I do not think that the Federal Government is likely to be able to show that Congress has authorized the unprecedented step of compelling over 10,000,000 healthcare workers to be vaccinated on pain of being fired,” Alito wrote in his dissent.

A White House spokesman did not immediately respond to CNBC’s request for comment on the rulings.

OSHA, which polices workplace safety for the Labor Department, issued the mandates under its emergency power established by Congress. OSHA can shortcut the normal rulemaking process, which can take years, if the Labor secretary determines a new workplace safety standard is necessary to protect workers from a grave danger.

The court’s decision to strike down the business mandate comes as the pandemic rages across the U.S., with the highly contagious omicron variant driving an unprecedented surge of new infections. The U.S. is reporting 786,000 new infections daily on average, a pandemic record and a 37% increase over last week, according to CNBC analysis of data from Johns Hopkins University.

Hospitalizations have also reached a pandemic high based on federal data going back to the summer of 2020. There are 149,000 Americans in U.S. hospitals with Covid, according to a seven-day average of data from the Department of Health and Human Services, up 27% over the past week.

The vaccine-or-test rules faced a raft of lawsuits from 27 states with Republican attorneys general or governors, private businesses, religious groups and national industry groups such as the National Retail Federation, the American Trucking Associations and the National Federation of Independent Business.

The NRF in a statement called the Supreme Court ruling a “victory,” urging the Biden administration “to discard this unlawful mandate and instead work with employers, employees and public health experts on practical ways to increase vaccination rates and mitigate the spread of the virus in 2022.”

The mandates were the most expansive use of power by the federal government to protect workers from Covid since the pandemic began. Taken together, the Biden administration estimated that the rules for businesses and health care workers would apply to approximately 100 million Americans.

But both rules had been in flux well before the Supreme Court took them on. The OSHA rules were blocked in November by a conservative federal appeals court, then reinstated by a different court weeks later.

The White House at the time urged businesses to follow the public safety requirements even if they were not being enforced.

Some companies have done so, and others have implemented their own rules. A number of large employers, including Citigroup, Nike and Columbia Sportswear, in recent days have said they would begin firing unvaccinated workers.