There are at least 1,030 confirmed cases in California and 18 people have died.

California’s 40 million residents should stay home indefinitely and venture outside only for essential jobs, errands and some exercise, Gov. Gavin Newsom said Thursday, warning that the coronavirus threatens to overwhelm the state’s medical system.

The move, the most sweeping by any state so far, was an exclamation point at the end of a week of increasingly aggressive moves meant to keep the virus in check by forcing people to stay away from each other as often as possible.

“I can assure you home isolation is not my preferred choice, I know it’s not yours, but it’s a necessary one,” Mr. Newsom said at an evening news conference streamed on social media.

Also read: Trump cancels in-person G7, summit to be held via video-conference

The announcement came after the release of a letter to President Donald Trump where Mr. Newsom warned the virus was spreading quickly and eventually could infect more than half the state’s population. A spokesman later clarified that the figure did not take into account the aggressive mitigation efforts that have been made.

The governor said he doesn’t expect police will be needed to enforce his stay-at-home order, saying “social pressure” already has led to social distancing throughout the state.

“I don’t believe the people of California need to be told through law enforcement that it’s appropriate just to home isolate,” he said.

The Democrat who is barely a year into his first term also called up 500 National Guard troops to help distribute food. The move comes after panic buying led to massive lines at some grocery stores.

Mr. Newsom also outlined a series of steps aimed at providing more space for hospital patients.

The coronavirus is spread through sneezes and coughs. There are at least 1,030 confirmed cases in California and 18 people have died, according to a tally by Johns Hopkins University.

Newsom’s statewide order came after counties and communities covering about half the state’s population already had issued similar edicts. He said the restriction is “open-ended” because it could raise false hopes if he included an end date.

“Safer at Home” in Los Angeles

Just before Newsom’s statewide declaration, Los Angeles announced what officials there called a “Safer at Home” order that carried the same restrictions.

“We’re about to enter into a new way of living here in Los Angeles,” Mayor Eric Garcetti said. “What we do and how we do it and if we get this right will determine how long this crisis lasts.”