As the pandemic took hold, most epidemiologists have had clear proscriptions in fighting it: No students in classrooms, no in-person religious services, no visits to sick relatives in hospitals, no large public gatherings.

So when conservative anti-lockdown protesters gathered on state Capitol steps in places like Columbus, Ohio and Lansing, Michigan, in April and May, epidemiologists scolded them and forecast surging infections.

When Gov. Brian Kemp of Georgia relaxed restrictions on businesses in late April as testing lagged and infections rose, the talk in public health circles was of that state’s embrace of human sacrifice.

And then the brutal killing of George Floyd by police in Minneapolis on May 25 changed everything.

Soon the streets nationwide were full of tens of thousands of people in a mass protest movement that continues to this day, with demonstrations and the toppling of statues. And rather than decrying mass gatherings, more than 1,300 public health officials signed a May 30 letter of support, and many joined the protests.

That reaction, and the contrast with the epidemiologists’ earlier fervent support for the lockdown, gave rise to an uncomfortable question: Was public health advice in a pandemic dependent on whether people approved of the mass gathering in question?

To many, the answer seemed to be “yes.”

“The way the public health narrative around coronavirus has reversed itself overnight seems an awful lot like … politicizing science,” essayist and journalist Thomas Chatterton Williams wrote in The Guardian last month. “What are we to make of such whiplash-inducing messaging?”

Of course, there are differences: A distinct majority of Floyd protesters wore masks in many cities, even if they often crowded too close together.

By contrast, many anti-lockdown protesters refused to wear masks — and their rallying cry ran contrary to public health officials’ instructions.

And in practical terms, no team of epidemiologists could have stopped the waves of impassioned protesters, any more than they could have blocked the anti-lockdown protests.

Still, the divergence in their own reactions left some of the country’s prominent epidemiologists wrestling with deeper questions of morality, responsibility and risk.

Catherine Troisi, an infectious disease epidemiologist at The University of Texas Health Science Center at Houston, studies COVID-19.

When, wearing a mask and standing at the edge of a great swell of people, she attended a recent protest in Houston supporting Floyd, a sense of contradiction tugged at her.

“I certainly condemned the anti-lockdown protests at the time, and I’m not condemning the protests now, and I struggle with that,” Troisi said. “I have a hard time articulating why that is OK.”

Mark Lurie, a professor of epidemiology at Brown University, described a similar struggle.

“Instinctively, many of us in public health feel a strong desire to act against accumulated generations of racial injustice,” Lurie said. “But we have to be honest: A few weeks before, we were criticizing protesters for arguing to open up the economy and saying that was dangerous behavior.

“I am still grappling with that.”

To which Ashish Jha, dean of Brown University’s School of Public Health, added: “Do I worry that mass protests will fuel more cases? Yes, I do. But a dam broke, and there’s no stopping that.”

Some public health scientists publicly waved off the conflicted feelings of their colleagues, saying the country now confronts a stark moral choice. The letter signed by more than 1,300 epidemiologists and health workers urged Americans to adopt a “consciously anti-racist” stance and framed the difference between the anti-lockdown demonstrators and the protesters in moral, ideological and racial terms.

Those who protested stay-at-home orders were “rooted in white nationalism and run contrary to respect for Black lives,” the letter stated.

By contrast, it said, those protesting systemic racism “must be supported.”

“As public health advocates,” they stated, “we do not condemn these gatherings as risky for COVID-19 transmission. We support them as vital to the national public health.”

There is as of yet no firm evidence that protests against police violence led to noticeable spikes in infection rates.

A study published by the National Bureau of Economic Research found no overall rise in infections, but could not rule out that infections might have risen in the age demographic of the protesters.

Health officials in Houston and Los Angeles have suggested the demonstrations there led to increased infections, but they have not provided data.

In New York City, Mayor Bill de Blasio has instructed contact tracers to ask infected people if they had been in big crowds but not if they attended any protests.

The 10 epidemiologists interviewed for this article said near-daily marches and rallies are nearly certain to result in some transmission. Police use of tear gas and pepper spray, and crowding protesters into police vans and buses, puts people further at risk.

“In all likelihood, some infections occurred at the protests; the question is how much,” Lurie said. “No major new evidence has emerged that suggests the protests were superspreader events.”

The virus has hit Black and Latino Americans with a particular ferocity, hospitalizing those populations at more than four times the rate of white Americans. Many face underlying health issues, and are more likely than most Americans to live in densely populated housing and to work on the front lines of this epidemic.

As a result, Latinos and Black people are dying at rates well in excess of white Americans.

Mary Travis Bassett, who is African American, served as the New York City health commissioner and now directs the FXB Center for Health and Human Rights at Harvard University. She noted that even before COVID-19, Black Americans were sicker and died more than two years earlier, on average, than white Americans.

And she noted that police violence has long cast a deep shadow over African Americans. From the auction block to plantations to centuries of lynchings carried out with the complicity of local law enforcement, Black people have suffered the devastating effects of state power.

She acknowledged that the current protests are freighted with moral complications, not least the possibility that a young person marching for justice might come home and inadvertently infect a mother, aunt or grandparent.

“If there’s an elder in the household, that person should be cocooned to the best extent that we can,” Bassett said.

But she said the opportunity to achieve a breakthrough transcended such worries about the virus.

“Racism has been killing people a lot longer than COVID-19,” she said. “The willingness to say we all bear the burden of that is deeply moving to me.”

Others take a more cautious view of the moral stakes.

Nicholas Christakis, professor of social and natural science at Yale University, noted that public health is guided by twin imperatives: to comfort the afflicted and to speak truth about risks to public health, no matter how unpleasant.

These often-complementary values are now in conflict. To take to the street to protest injustice is to risk casting open doors and letting the virus endanger tens of thousands, he said. There is a danger, he said, in asserting that one moral imperative overshadows another.

“The left and the right want to wish the virus away,” Christakis said. “We can’t wish away climate change, or the epidemic, or other inconvenient scientific truths.”

He said that framing the anti-lockdown protests as white supremacist and dangerous and the George Floyd protests as anti-racist and essential obscures a messier reality.

When he was a hospice doctor in Chicago and Boston, he said, he saw up close how isolation deepened the despair of the dying — a fate now suffered by many in the pandemic, with hospital visits severely restricted. For epidemiologists to turn around and argue for loosening the ground rules for the George Floyd marches risks sounding hypocritical.

“We allowed thousands of people to die alone,” he said. “We buried people by Zoom. Now all of a sudden we are saying, never mind?”

There are other conflicting imperatives. Lockdowns, and the shuttering of businesses and schools and enforcing social isolation, take a toll on the working class and poor, and the emotionally fraught who live on the economic margins.

The lockdown is justified, most epidemiologists say, even as it requires acknowledging a moral truth: To save many hundreds of thousands of lives, we risk wrecking the lives of a smaller number of Americans, as businesses fail and people lose jobs and grow desolate and depressed.

The pandemic has also brought an increase in deaths from heart attacks and diabetes during this period.

“Have people died because of the closed economy? No doubt,” said Lurie, the Brown University epidemiologist. “And that pain is real, and should not be dismissed. But you won’t have a healthy economy until you have healthy people.”

There is another epidemiological reality: No one quite understands the path of this idiosyncratic virus and how and when it strikes. The public health risks presented by the protests are not easily separated from the broader risks taken as governors, in fits and starts, move to reopen state economies. The protesters represent a small stream filled with 500,000 to perhaps 800,000 people, merging with a river of millions of Americans who have begun to reenter businesses and restaurants.

“To separate out those causes, when we look, will be very difficult,” Lurie said.

Still, he admitted to some worries. He said he took his daughter to a protest early in June and felt a chaser of regret in its wake.

“We felt afterward that the risk we incurred probably exceeded the entire risk in the previous two months,” he said. “We undid some very hard work, and I don’t see how actions like that can help in battling this epidemic, honestly.”