JOHANNESBURG, South Africa — When the clock struck midnight on Friday, South Africa, Africa’s most industrialized nation, ordered most of its 59 million people to stay at home for three weeks — the biggest and most restrictive action in the African continent to contain the spread of the coronavirus.

The lockdown was precipitated by an alarming increase in confirmed coronavirus cases across the nation’s nine provinces. Three weeks after the first infection was discovered in South Africa, the country is now the epicenter of the outbreak in the continent, with more than 1,000 confirmed cases, double the cases in Egypt.

In Johannesburg, the biggest city, shops and offices were shuttered in observance of the lockdown, announced on Tuesday. A few delivery trucks, minibus taxis and ambulances drove through roads normally clogged with rush-hour traffic.