The Supreme Court voted 5 to 4 on Tuesday night to leave in place the Centers for Disease Control and Prevention’s ban on evictions, imposed to combat the coronavirus pandemic and prevent homelessness.

The ban has just been extended another month, until the end of July, and the Biden administration said it will end then.

A group of landlords, real estate companies and real estate trade associations in Alabama and Georgia convinced U.S. District Judge Dabney Friedrich in the spring that the CDC lacked authority to impose the moratorium.

But Friedrich stayed her order to allow appeals to continue. A panel of the U.S. Court of Appeals for the D.C. Circuit kept it in place, saying it believed the government was likely to prevail.

At the Supreme Court, Chief Justice John G. Roberts Jr. joined fellow conservative Brett M. Kavanaugh and liberal Justices Stephen G. Breyer, Sonia Sotomayor and Elena Kagan to keep the stay in place.

Justices Clarence Thomas, Samuel A. Alito Jr. Neil M. Gorsuch and Amy Coney Barrett said they would have lifted the stay, which would have struck down the moratorium.

Neither side explained its reasoning in the short emergency order. But Kavanaugh wrote separately to say that while he agreed the CDC had exceeded its authority, this was not the time to scuttle the ban on evictions.

“Because the CDC plans to end the moratorium in only a few weeks, on July 31, and because those few weeks will allow for additional and more orderly distribution of the congressionally appropriated rental assistance funds,” the stay should remain in place, Kavanaugh said.

He added that in his view, any further extension of the moratorium would require “clear and specific congressional authorization” via new legislation.

On June 24, CDC Director Rochelle Walensky extended the evictions moratorium from June 30 until July 31. The CDC said “this is intended to be the final extension of the moratorium.”

The White House is ramping up efforts aimed at preventing evictions, in particular by accelerating the disbursal of federal aid to millions of renters across the country. These efforts are being led in part by Gene Sperling, who was brought into the administration to oversee implementation of the administration’s $1.9 trillion relief package, which included tens of billions in rental aid.

After a congressional moratorium on evictions expired last summer, President Donald Trump ordered the CDC to step in. It issued an order in September, citing its power to take emergency actions to stop the infection’s spread. It said it applied to tenants who, if evicted, would likely become homeless or be forced to live in close quarters in a congregate or shared-living setting.

The moratorium deadline has been extended several times.

The realtors told the Supreme Court that the CDC had gone too far and that the moratorium was no longer needed.

“If Americans can safely gather together indoors without adhering to the most basic COVID-19 precautions, then there is no longer any public-health rationale for the moratorium,” they said in their brief to the Supreme Court.

“The CDC’s continued insistence that public-health concerns necessitate that landlords continue to provide free housing for tenants who have received vaccines (or passed up the chance to get them) is sheer doublespeak.”

But the government’s lawyer, Acting Solicitor General Elizabeth B. Prelogar, told the court the CDC had the authority and its judgment should be trusted during the pandemic, especially as children go unvaccinated and new variants of the virus emerge.

She also said the pain felt by landlords is only temporary and that Congress has appropriated nearly $50 billion for rental assistance.

Local governments may use the funds “to pay up to 12 months of back rent and an additional three months of future rent for eligible tenants,” Prelogar wrote. “The funds are payable directly to landlords.”