Gov. Charlie Baker on Sunday took the most drastic moves yet to stem the spread of the coronavirus, banning eating inside bars and restaurants across the state and halting any gatherings of more than 25 people.

Baker closed all public and private schools across the state starting Tuesday, until April 6.

Also starting Tuesday, restaurants and bars will be allowed to provide takeout and delivery, but no on-site consumption of food and drink is permitted. The ban runs for three weeks, through April 6.

(Baker said at a Sunday night press conference that the bar and restaurant ban would run through April 17, but the order and a statement from his office says it runs until April 6. He also initially said the school closure ran until April 7 but the order states it goes until April 6.)

Baker said the move was driven by new coronavirus cases of unknown origin — what's known as community transmission — in seven counties. The state now has 164 known cases of coronavirus.

"I realize these measures are unprecedented, but we're asking our residents to take a deep breath and understand the rationale behind this guidance," Baker said.

(Editor's Note: Baker's remarks in the audio above begin at around the 2-minute mark.)

The ban on social gatherings does not apply to grocery stores or pharmacies, but does apply to gatherings at gyms, churches, concert halls movie theaters or any other public or private space. It expands an earlier ban by Baker on gatherings of more than 250 people.

The state isn't ordering the closure of childcare facilities, as Rhode Island did Sunday, but is recommending they follow Department of Public Health guidelines regarding temporary closures.

The ban also does not apply to retail stores. (Baker said at the press conference Sunday that retail stores would need to limit their capacity to 25 but the order says it does not apply.)

The state’s new restrictions on public gatherings of over 25 people appear to be the strictest in the nation. California and Washington state have restricted gatherings of 250 or more as of Saturday. It goes beyond the Centers for Disease Control and Prevention guidance to limit gatherings of 50 people.

Other measures announced by Baker Sunday included:

All commercial health insurance carriers are ordered to allow providers to deliver and cover services via telehealth, to avoid people traveling to doctors' offices. This was already done for MassHealth.

Starting Wednesday, all hospitals are directed to postpone elective surgeries so medical workers and hospital space remains available.

All assisted living facilities, nursing facilities and rest homes should ban visitors.

All hospitals must screen and restrict visitation, which some hospitals have already done.

Only emergency executive branch workers will report to work, plus those critical to the coronavirus response. The state's executive branch employs about 43,000 people.

The RMV will extend renewal times for certain credentials.

The requirements around unemployment claims will be relaxed. Baker will file emergency legislation to waive the one-week waiting period for unemployment, and expand eligibility.

Some pharmacies will be allowed to make and sell hand sanitizer.

In the announcement, Baker reiterated earlier remarks he made Sunday that he was not planning a statewide quarantine or forced shelter-in-place measures.

"A complete shutdown, especially for a lot of the folks who can't do the shopping associated with buying three months worth of stuff would put them in a terrible position," he said.

He added that under a lockdown, it would be difficult for K-12 students who rely on schools for meals to get them.

Baker stressed the need for people to take the cancellation of school seriously, and not to gather beyond existing households.

"We're urging parents and caretakers to use the next three weeks to truly practice social distancing," he said. "This means maintaining a safe separation of at least six feet from others. This means no free for all play dates and more time at home with only immediate family."

The measures came seven hours after Baker told WCVB-TV he didn't think schools needed to be shut down, and that cities and towns were best suited to make decisions on closing bars and restaurants. He said if the facts change, his decision will change.

Baker even said he would eat in a restaurant, provided he could keep proper social distancing.

By Sunday night, Baker said the facts had changed — including cases of community transmission — meaning officials don't know how someone caught the coronavirus — in Berkshire, Essex, Hampden, Middlesex, Suffolk, Norfolk and Worcester counties.

Baker's restaurant and bar closure supersedes measures announced just a few hours earlier by Boston Mayor Marty Walsh, which directed bars and restaurants to cut capacity by 50%.

Baker said these measures are just the beginning of the work that needs to be done to stop the outbreak.

"One of the great challenges we're all going to have over the course of the next few months is to recognize and understand that what we do every day is going to have a big impact — not just on what happens to us — but what happens to those people that we come in contact with," he said. "And we need to treat this and recognize that this is not a sprint. This is going to be a marathon."