Nearly every country has struggled to contain the corona­virus and made mistakes along the way.

But one country stands alone as the only affluent nation to have suffered a severe, sustained outbreak for more than four months: the United States.

The U.S. virus case count passed 5 million Saturday, more than any other nation.

How did this happen? The New York Times set out to reconstruct the unique failure through numerous interviews with scientists and public health experts around the world. It points to two central themes.

First, the United States faced long-standing challenges in confronting a major pandemic. It is a large country at the nexus of the global economy, with a tradition of prioritizing individualism over government restrictions.

“As an American, I think there is a lot of good to be said about our libertarian tradition,” Dr. Jared Baeten, an epidemiologist and vice dean at the University of Washington School of Public Health, said. “But this is the consequence: We don’t succeed as well as a collective.”

The second major theme is one that public health experts often find uncomfortable to discuss because many try to steer clear of partisan politics. But many agree that the poor results in the United States stem in substantial measure from the performance of the Trump administration.

In no other high-income country — and in only a few countries, period — have political leaders departed from expert advice as frequently and significantly as the Trump administration. President Donald Trump has said the virus was not serious, predicted it would disappear, spent weeks questioning the need for masks, encouraged states to reopen even with large and growing caseloads, and promoted medical disinformation.

Already, the U.S. death toll is of a different order of magnitude than in most other countries. With only 4% of the world’s population, the United States has accounted for 22% of coronavirus deaths.

“In many of the countries that have been very successful, they had a much crisper strategic direction and really had a vision,” said Caitlin Rivers, an epidemiologist at the Johns Hopkins Center for Health Security. “I’m not sure we ever really had a plan or a strategy — or at least it wasn’t public.”

Travel policy fell short

In retrospect, one of Trump’s first policy responses to the virus appears to have been one of his most promising.

On Jan. 31, his administration announced that it was restricting entry to the United States from China. Many foreign nationals — be they citizens of China or other countries — would not be allowed into the U.S. if they had been to China in the previous two weeks.

But it quickly became clear that the U.S. policy was full of holes. It did not apply to immediate family members of U.S. citizens and permanent residents returning from China, for example. In the two months after the policy went into place, almost 40,000 people arrived in the United States on direct flights from China.

Even more important, the policy failed to take into account that the virus had spread well beyond China by early February. Later data would show that many infected people arriving in the United States came from Europe.

The administration’s policy also did little to create quarantines for people who entered the United States and may have had the virus.

Authorities in some other places took a far more rigorous approach to travel restrictions.

South Korea, Hong Kong and Taiwan largely restricted entry to residents returning home. Those residents then had to quarantine for two weeks upon arrival, with the government keeping close tabs to ensure they did not leave their home or hotel.

The U.S. imposed few travel restrictions, either for foreigners or U.S. citizens. And individual states did little to enforce rules they did impose.

Double testing failure

On Jan. 16, nearly a week before the first announced case of the coronavirus in the United States, a German hospital announced that its researchers had developed a test for the virus. The researchers posted the formula for the test online and said they expected that countries with strong public health systems would soon be able to produce their own tests.

In the United States, the CDC developed its own test four days after the German lab did. CDC officials claimed that the U.S. test would be more accurate than the German one, by using three genetic sequences to detect the virus rather than two. The federal government quickly began distributing the U.S. test to state officials.

But the test had a flaw. The third genetic sequence produced inconclusive results, so the CDC told state labs to pause their work.

The flaw took weeks to fix. During that time, the United States had to restrict testing to people who had clear reason to think they had the virus. All the while, the virus was quietly spreading.

By early March, with the testing delays still unresolved, the New York region became a global center of the virus — without people realizing it until weeks later. More widespread testing could have made a major difference, experts said, leading to earlier lockdowns and social distancing and ultimately less sickness and death.

In recent weeks, the U.S. has been conducting more tests per capita than any other country, according to Johns Hopkins researchers.

But now there is a new problem: The virus has grown even more rapidly than testing capacity. In recent weeks, Americans have often had to wait in long lines, sometimes in scorching heat, to be tested.

The huge demand for tests has overwhelmed medical laboratories, and many need days — or even up to two weeks — to produce results. While people are waiting for their results, many are also spreading the virus.

Double mask failure

For the first few months of the pandemic, public health experts could not agree on a consistent message about masks. Some said masks reduced the spread of the virus. Many experts, however, discouraged the use of masks, saying — somewhat contradictorily — that their benefits were modest and that they should be reserved for medical workers.

The conflicting advice, echoed by the CDC and others, led to relatively little mask-wearing in many countries early in the pandemic. But several Asian countries were exceptions, partly because they had a tradition of mask-wearing to avoid sickness or minimize the effects of pollution.

In the following months, scientists around the world began to report two strands of evidence that both pointed to the importance of masks: Research showed that the virus could be transmitted through droplets that hang in the air, and several studies found that the virus spread less frequently in places where people were wearing masks.

In many countries, officials reacted to the emerging evidence with a clear message: Wear a mask.

In the U.S., however, masks became a political symbol.

Trump avoided wearing one in public for months. He poked fun at a reporter who wore one to a news conference, asking the reporter to take it off and saying that wearing one was “politically correct.”

Many other Republicans and conservative news outlets echoed his position. Mask-wearing, as a result, became yet another partisan divide in a highly polarized country.

Virus economics

As the United States endured weeks of closed stores and rising unemployment this spring, many politicians — particularly Republicans — argued that there was an unavoidable trade-off between public health and economic health. And if crushing the virus meant ruining the economy, maybe the side effects of the treatment were worse than the disease.

Early in the pandemic, Austan Goolsbee, a University of Chicago economist and former Obama administration official, proposed what he called the first rule of virus economics: “The best way to fix the economy is to get control of the virus,” he said. Until the virus was under control, many people would be afraid to resume normal life, and the economy would not function normally.

The events of the past few months have borne out Goolsbee’s prediction. Even before states announced shutdown orders in the spring, many families began sharply reducing their spending. They were responding to their own worries about the virus, not any official government policy.

And the end of lockdowns did not fix the economy’s problems. It instead led to a brief increase in spending and hiring that soon faded.

In the weeks after states reopened, the virus began surging. Those that opened earliest tended to have worse outbreaks, according to a Times analysis.

Americans, frightened by the virus’ resurgence, responded by visiting restaurants and stores less often. The economy’s brief recovery in April and May seems to have petered out in June and July.

The virus continues to overwhelm daily life.

“This isn’t actually rocket science,” said Dr. Thomas Frieden, who ran the New York City health department and the CDC for a combined 15 years. “We know what to do, and we’re not doing it.”