The Supreme Court ruled in favor of California's limits on the number of people who may attend a church service, in a decision that saw justices debating whether religious services were being treated more strictly than similar gatherings under restrictions aimed to limit the spread of the novel coronavirus.

Chief Justice John Roberts, a President George W. Bush appointee, joined four Democrat-appointed justices in the 5-4 majority Friday. His opinion emphasized the need to defer to elected officials amid efforts to respond to the Covid-19 epidemic.

"The precise question of when restrictions on particular social activities should be lifted during the pandemic is a dynamic and fact-intensive matter subject to reasonable disagreement," he said, adding that local officials are "actively shaping their response to changing facts on the ground."

Precedent entrusts to elected officials judgments about the safety and health of the people, he said, and they have especially broad latitude in areas of "medical and scientific uncertainties."

"Where those broad limits are not exceeded, 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," he continued.

The decision responded to an emergency appeal from the South Bay United Pentecostal Church and its senior pastor Bishop Arthur Hodges III, who had challenged California Gov. Gavin Newsom's order limiting churches to 25% of their normal maximum capacity, with 100 people maximum at any service. The church said it would follow other guidance on social distancing and hygiene.

Roberts said "comparable secular gatherings" have similar or more strict restrictions, including "lectures, concerts, movie showings, spectator sports, and theatrical performances, where large groups of people gather in close proximity for extended periods of time."

"And the order exempts or treats more leniently only dissimilar activities, such as operating grocery stores, banks, and laundromats, in which people neither congregate in large groups nor remain in close proximity for extended periods," he said.

In a mid-May interview, Hodges stressed the need for in-person events at his church.

"For example, it's essential for people to be baptized," he told NBC San Diego. "But you can't baptize yourself. You have to have the church, the clergy, to do that."

In a May 29 post on Twitter, Hodges said "a decision by the U.S. Supreme Court is necessary to avoid civil disobedience by thousands of churches in California and other states on this Pentecost Sunday, May 31."

The church had filed an injunction request alleging that state and local officials "intentionally denigrated California churches and pastors and people of faith by relegating them to third-class citizenship," City News Service reports. It objected to the placement of places of worship in Stage 3 of California's reopening plan. This stage includes movie theaters, salons and gyms. The church also argued that manufacturing and warehouses had been arbitrarily classed in Stage 2, a faster track for reopening.

Roberts said the restrictions "appear consistent with the free exercise clause of the First Amendment." He rejected the claim that it is "indisputably clear" the government limitations are unconstitutional.

Justice Brett Kavanaugh, however, said the occupancy cap "indisputably discriminates against religion, and such discrimination violates the First Amendment."

"The church would suffer irreparable harm from not being able to hold services on Pentecost Sunday in a way that comparable secular businesses and persons can conduct their activities," he said in his dissent.

"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 continued.

(Story continues below)

Kavanaugh said the state must offer a "compelling justification" to distinguish between religious worship services and "the litany of other secular businesses that are not subject to an occupancy cap."

"California has not shown such a justification," he said, noting the importance of the church's willingness to abide by state rules that apply to comparable secular business, including social distancing and hygiene rules.

"I would grant the Church's requested temporary injunction because California's latest safety guidelines discriminate against places of worship and in favor of comparable secular businesses. Such discrimination violates the First Amendment," he said.

Kavanaugh's dissent was joined by Justices Clarence Thomas and Neil Gorsuch. Justice Samuel Alito dissented but did not join the opinion.

The court rejected a different appeal from two Chicago-area churches that challenged a 10-person limit on attendees at religious services. Before the court took action, Gov. Jay Pritzker increased the limit to 100 attendees per service.

The churches, Elim Romanian Pentecostal Church of Chicago and Logos Baptist Ministries of Niles, Ill., had both sought to open ahead of the Christian holy day of Pentecost.