(CNN) The nation's most populous state is ordering its nearly 40 million residents to stay home to prevent the spread of the deadly coronavirus.

Nineteen people have died and more than 900 tested positive for coronavirus in California.

California Gov. Gavin Newsom's order marks the first statewide mandatory restrictions in the United States to help combat the outbreak. It went into effect at midnight Thursday, meaning Californians should not leave home except for essential things such as food, prescriptions , health care and commuting to jobs considered crucial.

"This is a moment where we need some straight talk," Newsom told reporters. "As individuals and as a community, we need to do more to meet this moment."

The order will not be enforced by law enforcement, he added.

"I don't believe the people of California need to be told through law enforcement that it's appropriate just to home-isolate, protect themselves," Newsom said. "We are confident that the people of the state of California will abide by it and do the right thing."

Essential services will be open

Under the order, essential services such as groceries, pharmacies, gas stations, farmers markets, food banks, convenience stores and delivery restaurants will remain open. So will banks, local government offices that provide services and law enforcement agencies.

Nonessential services such as dine-in restaurants, bars , gyms and convention centers will shut down, the governor said.

Newsom's order follows his request to President Donald Trump to send a US Navy medical ship to provide more health care options for the state.

"We project that roughly 56% of our state's population -- 25.5 million people -- will be infected with the virus over an eight-week period," he said in a Wednesday letter to Trump asking him to send the USNS Mercy hospital ship to the Port of Los Angeles for use through September 1.

California has been helping people returning to the US from overseas and needs the San Diego-based ship to help "decompress" its health care system as infection rates skyrocket, Newsom wrote. He warned that infection rates are doubling every four days in some parts of the state.

Coronavirus tracking models show its spread in California could require the hospitalization of more than 19,000 people beyond the state's current capacity.

"If we change our behaviors, that inventory will come down; if we meet this moment, we can truly bend the curve to reduce the need to surge -- to have to go out to have to cobble together all those assets together," Newsom said.

Officials plan to use dorm rooms at state universities to temporarily house coronavirus patients, along with hospitals that will support containment efforts.

Social distance is still required

Even with the order, California residents who take part in essential activities will have to maintain a social distance.

"Go about the essential patterns of life, but do so by socially distancing themselves from others and do so using a common sense," Newsom said. "Home isolation is not my preferred choice, but it is a necessary one. This is not a permanent state; it is a moment in time."

Before Newsom's announcement, other counties in Los Angeles and the San Francisco Bay Area had issued similar mandates . Officials in other states also are struggling to find ways to combat the fast-moving virus to avoid an influx of patients from overstretching medical facilities.

In New York, where coronavirus has killed 32 people, Gov. Andrew Cuomo said he has no plans to impose a statewide mandate