New York City is shuttering schools to try to stop the renewed spread of the coronavirus, Mayor Bill de Blasio said Wednesday in a painful about-face for one of the first big U.S. school systems to bring students back to classrooms this fall.

The nation's largest public school system will halt in-person learning Thursday, sending more than 1 million children into all-online classes, the mayor said.

The Democrat said at an afternoon news conference that plans were being made to bring in-person learning back as quickly as possible if the infection rate drops, though he cautioned that the bar to return would be higher than it was to close down. He added that schools would definitely remain closed through Thanksgiving.

De Blasio said increased virus testing of children at schools would be a component of the return plan and parental consent for that testing would be required for pupils hoping to come back.

"We're going to fight this back," de Blasio said. "This is a setback, but it's a setback we will overcome."

It can't be overcome soon enough for Darneice Foster. She has four children, ranging in age from 4 to 13, now set to be learning from home.

"I don't know what I'm going to do, except pull my hair out," she said.

The city's springtime stretch of all-online learning was "really awful" for the family, which shares a one-bedroom apartment in Upper Manhattan, said Foster, a former pharmaceutical advertising worker who left her job some years ago when one of her children had health problems.

"Now, I really want my kids to catch up, and I'm one person," she said. She said she would "look on the sunny side and just bear it for a few weeks," hoping schools would reopen soon.

The city had said since summer that school buildings would close if 3% of all the coronavirus tests performed citywide over a seven-day period came back positive. As the rate neared that point last week, de Blasio advised parents to prepare for a possible shutdown.

The mayor said the rate equaled that mark as of Tuesday. And in fact, a revision of earlier city data showed it had likely been above that threshold since Nov. 11.

The city's public school students will now be taught entirely online, as most already are. As of the end of October, only about 25% of students had attended class in person this fall, far fewer than officials had expected.

Some city parents and officials had lobbied hard for the mayor to take other actions first before restoring to a schools closure, like ending indoor restaurant dining or requiring nonessential businesses to close.

"It is a massive failure of leadership to have allowed our schools to close before we got a handle on the virus spreading in indoor restaurants, bars, and gyms, worship and other gatherings. Schools should be the last things to close, not the first," City Council member Brad Lander said in a statement.

New York City's school system, like others across the nation, initially halted in-person learning in mid-March as the virus spiked. In-person school resumed Sept. 21 for pre-kindergarteners and some special education students. Elementary schools opened Sept. 29 and high schools Oct. 1. To keep students spread out, the city offered in-person learning only part-time.

At the time, the seven-day positive test average rate was under 2%.

Even as the school system stayed open, nearly 1,500 classrooms went through temporary closures after students or staffers tested positive, and officials began instituting local shutdowns in neighbourhoods where coronavirus cases were rising rapidly.

As of midweek, more than 2,300 students or staff at public schools had tested positive since the start of the school year.

While many big U.S. school districts had decided to start the fall term with online learning, de Blasio pushed for opening schoolhouse doors. The Democrat argued that students needed services they got in school and that many parents were counting on it in order to get back to work.

The reopening date, originally set for Sept. 10, was postponed twice as teachers, principals and some parents said safety precautions and staffing were inadequate, with the teachers' union at one point threatening to strike.

The city agreed to changes, including hiring thousands more teachers and testing 10% to 20% of all students and staffers per month for the virus.

When high schools finally opened their doors, de Blasio hailed it as "an absolutely amazing moment" in the city's recovery.

Wednesday's announcement from the city came just as New York Gov. Andrew Cuomo, who has frequently overruled the mayor on major decisions related to the pandemic, was finishing a news conference in which he said the city had the authority to shut things down if it wished to do so.

Cuomo predicted a "tremendous spike" in COVID-19 cases after Thanksgiving as he pleaded with people not to be lulled into a false sense of safety over the holiday.

"Your family sounds safe, doesn't it? Your home sounds safe. Your dining room table at Thanksgiving sounds safe," Cuomo said at a state capitol briefing. "No, you won't be safe. It's an illusion."

Parts of western New York that have been under the least onerous "yellow zone" restrictions are now under more restrictive "orange zone" restrictions, in which schools go remote and "high-risk" businesses such as gyms are closed, Cuomo said.

------

Associated Press writer Karen Matthews contributed from New York.