LONDON — Facing a growing storm of criticism about his laissez-faire response to the fast-spreading coronavirus, Prime Minister Boris Johnson announced on Monday that he would place Britain under a virtual lockdown, closing all nonessential shops, banning meetings of more than two people, and requiring people to stay in their homes, except for trips for food or medicine.

People who flout the new restrictions, the prime minister said, will be fined by the police.

The steps, which Mr. Johnson outlined in a televised address to the nation, bring him into alignment with European leaders like President Emmanuel Macron of France and Chancellor Angela Merkel of Germany, who have all but quarantined their countries in a desperate bid to slow the outbreak.

“No prime minister wants to enact measures like this,” a grave Mr. Johnson said. “I know the damage that this disruption is doing and will do to people’s lives, to their businesses and to their jobs.”

But while these were the most draconian restrictions placed on the British people since World War II, Mr. Johnson is still leaving a bit of breathing room.