A coronavirus vaccine mandate for teachers and other employees in New York City schools, the nation’s largest school district, has been temporarily halted by a federal appeals court just days before the deadline.

The injunction, granted Friday by a judge in the U.S. Court of Appeals for the Second Circuit, comes as many school districts nationally are adopting vaccine rules in an effort to keep schools open for in-person learning amid the spread of the highly contagious delta variant.

In New York City, 18 percent of the system’s nearly 150,000 employees had not yet shown proof of vaccination but had until midnight on Monday to do so, according to school system officials.

Under the judge’s order, the case will now go to a three-judge panel. It was filed by four city educators who argued that while safety is essential, the punishment for those who do not comply with the mandate — potentially losing jobs, benefits or seniority — is “draconian.”

That severity of such consequences “shocks the conscience, violates constitutional rights, and not only should not be permitted but must be restrained immediately to prevent irreparable harm,” the complaint said.

New York City school officials, who argue the mandate could save lives at a time when hundreds of thousands of students are not yet eligible or able to be vaccinated, said Saturday they expected to prevail. The mandate does away with the option of getting tested weekly instead of a vaccination.

“We’re confident our vaccine mandate will continue to be upheld once all the facts have been presented, because that is the level of protection our students and staff deserve,” Danielle Filson, of the New York City Department of Education, said in an email.

Filson said the system’s current “vax-or-test” mandate remains in effect and officials are seeking a “speedy resolution” by the court.

About 88 percent of teachers and 95 percent of principals are vaccinated, according to the education department, with more than 7,000 vaccinations administered on school campuses last week.

A lawyer for the city educators who filed the complaint did not immediately respond to a request for comment Saturday.

The legal action is not the only challenge to the city’s school employee vaccination mandate. A state judge considering a different case last week decided in favor of allowing the mandate, though the case is not closed.

New York Mayor Bill de Blasio announced the vaccine mandate in late August, saying all staff — teachers, principals, custodians, food-service workers — must have at least one dose by Sept. 27 to ensure in-person learning continues as the pandemic persists.

“We know this is going to help ensure that everyone is safe,” he said at the time.

As Monday’s vaccination deadline neared, many in New York worried about a sudden staff shortage, which could be debilitating at some schools in the million-student system.

Michael Mulgrew, president of the United Federation of Teachers, and Mark Cannizzaro, president of the Council of School Supervisors and Administrators, pointed to the looming fallout of the mandate at a news conference Friday.

They said they have heard from principals who have more than 100 staff members who had not complied with the mandate and risked losing those employees.

“While we still await a ruling in a separate state court review of the city’s vaccine mandate, the federal court ruling gives the Mayor and city Department of Education more time to put together a real plan for dealing with the expected staff vacancies the mandate would create,” Mulgrew said in a Saturday statement. “We hope they take advantage of this opportunity.”

Daniel Domenech, executive director of the AASA, the school superintendents association, said he expects education leaders around the country to follow the New York case closely.

Employee vaccine mandates are important and needed to keep students and staff safe in the nation’s schools, he said, but they also stand to exacerbate staffing shortages.

“You’re damned if you do, and damned if you don’t,” he said.

Jurisdictions including D.C. and Maryland’s Montgomery County have mandated that school employees be vaccinated.

In Los Angeles, the school system is requiring vaccinations for students ages 12 and older, with officials saying the shots represent the best way to protect students and keep schools open for in-person learning.

Rachel Weiner contributed to this report.