PARIS — With the spread of the coronavirus accelerating at an alarming rate in France, President Emmanuel Macron addressed the nation Monday evening with a call for mobilization. Before millions of television viewers, he looked directly into the camera and declared, “We are at war.” In 20 minutes, he said it six times.

Mr. Macron announced new restrictions on daily life that will keep the French confined to their homes, except for brief forays to shop for food or to go to indispensable jobs. It was his second attempt in five days to rally the unruly French and convince them that the only way to fight the virus was to accept social distancing.

It has not been easy. After the terrorist attacks in Paris on Nov. 13, 2015, that killed 130 people, many of them gunned down at cafe terraces, Parisians took pride in going out again, in a defiant collective gesture. The hashtag #JeSuisEnTerrasse flourished on social networks, echoing the earlier slogan “Je Suis Charlie” that had followed the attack on Charlie Hebdo’s journalists some months earlier. Last week, faced with an even deadlier enemy, the invisible virus, Parisians were instructed to do exactly the opposite by a new hashtag: #RestezChezVous (Stay Home).

In a previous TV address on Thursday, March 12, Mr. Macron announced that nurseries, schools and colleges were being shut down. This did not prevent the French from flocking, during last weekend, to bars and restaurants as though joie de vivre could beat the coronavirus. Then, with Mr. Macron’s TV speech on Monday, came new restrictions, closing all public places and businesses other than food stores, pharmacies, newsstands and banks. Should he have also canceled the local elections, held the day before?