San Francisco and surrounding counties totaling 6.7 million people will prohibit anyone from leaving their homes "except for essential needs" beginning at midnight Monday.
San Francisco Mayor London Breed said at a news conference that the drastic steps are meant to slow the spread of the coronavirus.
"The new public health order that we're announcing will require San Franciscans to remain at home with exceptions only for essential outings," she said. "These measures will be disruptive to daily life, but there is no need to panic."
It's the largest city to impose an in-home curfew or other stay-home order in the U.S. so far. Similar orders will apply in several San Francisco Bay Area counties until April 7, she said, although she added that the date could change depending on the advice of health officials.
Pharmacies, grocery stores, banks, gas stations and essential government services will remain open, as will restaurants, but only for takeout and delivery orders, Breed said. Bars and gyms will close. "Your garbage will be picked up," she said.
Failure to comply will be a misdemeanor, Police Chief Bill Scott said, but he and other officials said they're hoping for voluntary compliance.
It appeared to be the most extreme measure taken nationwide in response to the pandemic, echoing similar steps taken in several European and Asian cities.
"The virus is here in San Francisco. We must practice social distancing to slow it down," Dr. Grant Colfax, director of the city's Public Health Department, said at the news conference.
"Every hour counts," he said.
The order excludes drivers for ride-sharing companies like Uber and Lyft and for delivery services, and Gig Workers Rising responded in a statement later Monday. "Gig workers have become frontline responders, often driving people to the hospital or delivering food to those who have been quarantined," but they don't have paid time off, the advocacy group said.
Washington Gov. Jay Inslee, whose state has been at the center of the pandemic in the U.S., said Sunday that he was planning to ban gatherings of more than 50 people, while Hoboken, New Jersey, announced a curfew Saturday.
In Massachusetts, Gov. Charlie Baker said Sunday that there were no plans for a shelter-in-place order there, despite other restrictions.
Colfax said health officials in several Bay Area counties spoke over the weekend and agreed that more radical action was necessary.
"Today's decision was reached collectively, and the entire region is acting as one," he said.
The orders in the Bay Area will allow for some flexibility, officials said. People will be able to travel to shop for necessary supplies, access health care and provide aid to family and friends, as well as to exercise.
Download the NBC News app for full coverage of the coronavirus outbreak
Norman Yee, president of the San Francisco Board of Supervisors, the city council, said other elected officials supported the mayor's action. He urged residents to comply.
"We can give orders, but if you don't follow it, they're useless," he said.
Earlier Monday, Breed announced a $10 million program to provide paid sick leave to private-sector workers who have been affected by the pandemic.