On Feb. 21, Lebanon reported its first coronavirus infection. Eight days later, the schools were closed, followed quickly by bars, restaurants and the airport. By the time the government declared a total lockdown on March 15, the entire country had already shut down, in a state of self-induced panic as the number of cases seemingly soared.

It was terrifying. Few places in the world, except for parts of Italy and China, were taking such drastic steps at that time. In the United States, President Trump was still downplaying the risks and resisting restrictions. So why was this happening to us?

I frantically telephoned doctors and health experts to seek answers. The outlook was bleak. The best-case projections, based on modeling from China, anticipated tens of thousands of infections. Only 128 hospital beds and seven ICUs were available nationwide for coronavirus patients.

One major international health organization asked me not to share its worst-case scenarios. They involved multiple zeros and scared me silly.

Now, two months since that first case, Lebanon has reported just 682 coronavirus infections and 22 deaths. It is far behind (or ahead) of Norway, which is widely regarded as having done a good job of managing the spread of covid-19 and has a slightly smaller population — 5.3 million compared with Lebanon’s 6 million. Norway has over 7,000 cases and 187 deaths, as of Wednesday.

Somehow, this messed-up country, teetering on the brink of economic ruin and political chaos, has done something right when it comes to the coronavirus.

“It’s amazing,” said Samer Saab, dean of graduate studies and research at the Lebanese American University. He published a paper in early March forecasting that Lebanon would have 13,217 infections and 454 deaths by summer even in the best case scenarios involving social distancing. Without the lockdown, he had predicted the country would have more than 2.5 million infections and 150,000 deaths.

“Nobody expected the numbers to be so low,” he said.

The covid-19 infection curve has not exactly been flat, but it has ascended gently enough to allow an expansion of hospital capacity, to the point where there are more beds available than patients to fill them. There hasn’t been a death since last week.

There are enough tests available to test everyone with symptoms, for free at government hospitals or for a fee at private ones. Results are returned within 24 hours, much less time than it often takes Americans to receive their results.

There is no shortage of protective equipment for health workers. Face masks, gloves and hand sanitizer are widely available in stores — and are widely used. Some supermarkets are handing out freebie face shields emblazoned with their logo.

Health experts attribute the success above all to the swift and strictly observed lockdown.

By way of comparison: Cook County in Illinois, which includes the city of Chicago and has a smaller population (5.1 million), reported its first coronavirus case on Jan. 24, nearly a month before Lebanon. The state of Illinois closed schools on March 13, two weeks after Lebanon. It issued a stay-at-home order on March 20, five days after Lebanon had locked down. As of Wednesday, Cook County had reported 24,546 infections and 1,072 deaths.

Paradoxically, distrust of the country’s notoriously dysfunctional government may have helped, said Nasser Yassin, director of research at the American University of Beirut’s Issam Fares Institute for Public Policy and International Affairs. “Given the health system and the way the government operates, you cannot trust they’ll be able to cope.”

And, in contrast to some other worse-hit countries, no senior politicians sought to dismiss or downplay the risks.

“In Lebanon, everybody has been terrified from day one,” said Souha Kanj, who heads the infectious diseases department at the American University of Beirut Medical Center. “In a way, it’s good to be scared and panic because it forces you to be more vigilant.”

Lebanon’s small size is another factor, enabling extensive contact tracing. Almost all the early cases detected among arrivals from Europe and Iran, no matter how mild their symptoms, were isolated in the Rafik Hariri University Hospital, the main government hospital charged with managing the epidemic, said Firass Abiad, the hospital’s general manager.

Mild cases are now given the option of hospitalization or quarantining at home. Many poorer patients choose the hospital because it is free and at home they live in overcrowded conditions. This further aids the containment, Abiad said.

Lebanon’s relatively young population has also helped, said Krystel Moussally, regional epidemiologist for the international aid agency Doctors Without Borders, who in March predicted over 630,000 infections in Lebanon, based on information available at the time.

There are almost certainly unreported cases, including among asymptomatic people, as in other countries worldwide. There are suspicions around the low number of reported infections in southern Lebanon, which is controlled by the Hezbollah movement, compared with the rest of the country. Hezbollah runs its own parallel health system and may not have reported all the infections detected there.

But there do not appear to be significant numbers of unreported deaths or severe cases, Kanj said. Doctors around the country maintain daily contact with one another, and any unexpected spike in deaths would be hard to hide in a nation the size of Lebanon, she said.

“This is such a small country, you would hear about this if it was happening much more than your average expected deaths,” Kanj said.

Lebanon is not out of the woods yet. The recent experience of Singapore is cautionary, Abiad said. Until last week, Singapore — with a slightly smaller population (5.1 million) — had reported a slightly lower number of infections than Lebanon.

The Singapore numbers have since jumped more than tenfold, with more than 8,000 new infections showing up in recent days as covid-19 belatedly hits the cramped dormitories where migrant workers live.

Lebanon could witness a similar surge if covid-19 spreads through the country’s refugee community, Abiad said. Nearly 1.5 million residents are Syrian or Palestinian refugees, and they live in densely populated camps and informal settlements.

The first refugee case was confirmed on Tuesday, in the Wavel camp in eastern Lebanon. Health teams have gone to the camp to test and isolate the woman’s contacts, Abiad said. “Here in Lebanon, our nightmare is for it to reach the crowded refugee camps,” he said.

Meanwhile, Lebanese are tired of staying indoors. The weather is glorious, the economy dire. People are starting to venture out again, to work or to socialize. Protests against the country’s political leaders have resumed, in a sign of growing frustrations.

A second wave seems inevitable in the months ahead, Abiad warned.

But for now, Lebanese have been “pleasantly surprised” by how the coronavirus has played out, Kanj said. Not much else is going right for the country, but on the coronavirus front, she said, “something seems to be working well.”