The Supreme Court’s deeply divided order rejecting an emergency challenge to California’s pandemic-related restrictions on places of worship still provides a guide for lower courts balancing government rules intended to preserve public health with parishioners’ constitutional religious rights.

Just before midnight Friday, the court on a 5-to-4 vote rejected a challenge from South Bay Pentecostal Church near San Diego. The church had argued that Gov. Gavin Newsom’s (D) reopening orders violated the Constitution by placing fewer restrictions on some secular businesses than houses of worship.

But Chief Justice John G. Roberts Jr. joined with the court’s four consistent liberals to reject the church’s call to stop enforcement of the restrictions.

“California’s guidelines place restrictions on places of worship, those restrictions appear consistent with the Free Exercise Clause of the First Amendment,” Roberts wrote in his opinion.

Although Justices Ruth Bader Ginsburg, Stephen G. Breyer, Sonia Sotomayor and Elena Kagan did not sign on to Roberts’ opinion, his vote provides the majority.

And in only five paragraphs, Roberts laid out what will likely be the test for courts going forward.

He said they should be deferential to local and state officials who are faced with a historically difficult task of preventing the deadly virus while attempting to reopen sectors of American society that have been shuttered for weeks.

“At this time, there is no known cure, no effective treatment, and no vaccine,” he wrote. “Because people may be infected but asymptomatic, they may unwittingly infect others.”

Protecting public health is a “dynamic and fact-intensive matter subject to reasonable disagreement, but one the Constitution “principally entrusts” to elected officials.

Generally, he said, “they should not be subject to second-guessing by an unelected federal judiciary, which lacks the background, competence, and expertise to assess public health and is not accountable to the people.”

Although President Trump said earlier this month that governors and local officials should treat churches, mosques and synagogues as “essential” businesses, Roberts implied that is not the right comparison when judging whether restrictions on worship services comply with the Constitution’s guarantee of free religious exercise.

California’s new restrictions limit church attendance to 100 attendees or 25 percent of its capacity, whichever is lower. The question is whether similar activities are treated equally, Roberts wrote, and that seemed to be the case.

The state imposes similar or more severe restrictions on “comparable secular gatherings, including lectures, concerts, movie showings, spectator sports, and theatrical performances, where large groups of people gather in close proximity for extended periods of time,” he wrote.

It is more lenient on grocery stores, banks and laundromats, Roberts allowed, but those are situations “in which people neither congregate in large groups nor remain in close proximity for extended periods.”

Richard Garnett, a law professor at Notre Dame and director of its Program on Church, State & Society, said the order shows that “it can be challenging to identify discrimination or unequal treatment. … The justices disagreed about what kinds of activities church services are more like, for public-health purposes. Are they more like stores or like theaters?”

Justice Brett M. Kavanaugh, in dissent, wrote that the churches should be compared to businesses.

“The basic constitutional problem is that comparable secular businesses are not subject to a 25% occupancy cap, including factories, offices, supermarkets, restaurants, retail stores, pharmacies, shopping malls, pet grooming shops, bookstores, florists, hair salons, and cannabis dispensaries,” he wrote.

South Bay says it normally has 200 to 300 congregants in a 600-seat sanctuary for each of its Sunday services. The church says it plans to observe social-distancing guidelines, such as allowing only families to sit together and leaving every other row vacant.

“Assuming all of the same precautions are taken, why can someone safely walk down a grocery store aisle but not a pew?” Kavanaugh wrote. “And why can someone safely interact with a brave deliverywoman but not with a stoic minister?”

Kavanaugh did not address Roberts’s point about church services being events in which large numbers of people are together for an extended time.

Justices Clarence Thomas and Neil M. Gorsuch joined Kavanaugh’s dissent. The court’s order said Justice Samuel A. Alito Jr. would have granted South Bay’s request, but he did not join Kavanaugh’s opinion.

Lawyers for South Bay said the fight against California’s restrictions will continue in lower court.

Charles LiMandri, serving as special counsel to the Thomas More Society, said in a statement that the “disappointing ruling” was based on the high standard required to get an emergency injunction.

“If it is necessary to go back up to the U.S. Supreme Court … we will benefit from a much more favorable standard. We are hopeful that fact would also lead to a better result for religious liberty.”

South Bay and other churches will be able to hold in-person services Sunday, just under the California restrictions. They had pushed for a decision by this weekend, because of the Christian holy day of Pentecost, which falls 49 days after Easter.

In a separate, less-controversial case from Illinois, the Supreme Court without noted dissent turned down a request from churches near Chicago. The governor has lifted the restrictions the churches complained about.