LONDON — Boris Johnson, perhaps the world's most famous coronavirus patient, was back at work Monday — after spending the worst of Britain's epidemic sidelined, first in self-isolation, then struggling to breathe in the hospital, and later in recovery in the countryside.

Johnson has been absent for most of the six weeks of lockdown he ordered in March. Almost all of the novel coronavirus deaths that Britain has recorded — more than 21,000 — took place after the prime minister himself entered the hospital and disappeared from public view. Nearly 4 million workers were furloughed while Johnson was sick and struggling to get well.

His illness rattled the country, and even those who disliked him cheered for his return. But he may not get much of a grace period. Tough questions have been raised about why his lockdown didn’t come sooner, and why his government has struggled to deploy testing and provide protective equipment for front-line health workers. There is also growing pressure from some quarters to loosen the lockdown and reopen the economy.

On Monday morning, the prime minister appeared outside 10 Downing Street and apologized for being “away from my desk for much longer than I would have liked.”

He thanked the ministers who stood in for him while he was away, as well as the people for their “sheer grit and guts.”

“If this virus were a physical assailant, an unexpected and invisible mugger — which I can tell you from personal experience, it is — then this is the moment when we have begun together to wrestle it to the floor,” he said, standing at a lectern in a blue suit and red tie, with his yellow mop of hair as artfully askew as ever.

But he urged Britons not to lose patience with the lockdown, saying this was still a “moment of maximum risk.”

“I know it is tough, and I want to get this economy moving as fast as I can, but I refuse to throw away all the effort and the sacrifice of the British people and to risk a second major outbreak and huge loss of life,” he said.

Although aides and colleagues emphasized that Johnson was “in good spirits” during his illness, the prime minister has conceded that he could have been one of the dead. Upon his release from the hospital, Johnson said it “could have gone either way” while he was in intensive care. His aides say he was given “oxygen therapy” but never placed on a mechanical ventilator.

Foreign Secretary Dominic Raab, who served as leader of the country for the past three weeks, said Sunday that his thoughts had always been on Johnson and his family, “particularly when we knew it was touch and go.”

The prime minister’s father, Stanley Johnson, told broadcasters that his son “almost took one for the team.”

Monday was the first time Britons had seen their prime minister in public since March 26, three days after he ordered the lockdown.

In that last public appearance, when he stood outside the official residence to applaud National Health Service workers, he already had a persistent cough and high temperature. The next morning, his official spokesman revealed that Johnson had tested positive for the coronavirus.

For 10 days, as Johnson isolated himself at home and had his meals left on a tray at the door, his aides insisted he was continuing to lead the country’s response to the virus via telephone calls and videoconferencing. During that time, Johnson posted several short videos. He looked drained and pale.

Even after he was hospitalized on April 5, Johnson’s aides maintained that he was working from his bed. But after he was moved to the intensive care unit the next day, he handed control to Raab.

When Johnson went into the hospital, there had been 555 coronavirus deaths recorded in England and Wales, and fewer than 100 in Northern Ireland and Scotland. By the time he returned to his leadership role on Monday, more than 21,000 people had died of the virus — meaning he was out of commission for more than 97 percent of the deaths.

While Johnson was recovering, a Sunday Times article headlined “38 days when Britain sleepwalked into disaster” criticized his administration for being slow to act.

The article said that even before Johnson became sick, he had missed five of the government’s emergency “COBRA” crisis meetings on the virus.

In January, the article said, Johnson was focused on Brexit. In February, he was distracted by his personal life. In mid-February, Johnson agreed to a divorce settlement with Marina Wheeler, with whom he has four children. At the end of the month, Johnson and his 32-year-old partner, Carrie Symonds, announced their engagement and said they are expecting a baby in early summer.

In mid-February, Johnson was criticized for going on a “working holiday” with Symonds to Chevening, a government-owned country estate, instead of attending to the threat of the virus or visiting flood-hit communities in Yorkshire and Wales.

“WhereIsBoris” trended on social media in the United Kingdom. Jeremy Corbyn, who was then leader of the opposition Labour Party, labeled Johnson a “part-time” prime minister.

Britain is looking for Johnson’s leadership now.

While he has been sidelined by illness, businesses and workers have been flogged. Economists estimate that the coronavirus lockdown might be sapping almost $3 billion a day out of the British economy.

But while many countries around the world begin to lift stay-at-home measures and reopen businesses, Johnson signaled that Britain was not ready to ease up.

A second spike in infections would, he said, be an economic “disaster.”

“I ask you to contain your impatience, because I believe we are coming now to the end of the first phase of this conflict, and, in spite of all the suffering, we have so nearly succeeded.”