On the first day of virtual classes in Des Moines, an Iowa judge ruled the school system must abide by a state mandate and open schools for face-to-face instruction, even as coronavirus cases in the city and across the state surge far beyond what experts say is safe to bring children back to classrooms.

The Des Moines Public Schools system sued Gov. Kim Reynolds (R) and other state officials in late August after Reynolds mandated that nearly all schools in the state reopen. Des Moines school officials believe it is still not safe to send children and teachers back to classrooms, pointing to the state’s surge in coronavirus cases.

“No circumstances in our lifetimes have had a greater impact on the ability of school districts to operate safely than the COVID-19 global health pandemic,” school officials wrote in the lawsuit. “This is literally a matter of life and death.”

Tuesday, the judge denied the school district’s request to suspend the mandate while the legal challenge makes its way through the courts. The ruling means that if the school system does not offer face-to-face instruction to all students, it could be in violation of state law.

Schools Superintendent Thomas Ahart said Tuesday in a statement that he was disappointed with the ruling and that it forced him to choose between sending his students and staff back to classrooms without adequate safeguards or risk losing state funding by disobeying the state mandate.

“The court acknowledged that DMPS is faced with an impossible choice: resume on-site instruction without the ability to comply with CDC guidelines and risk serious harm to the health and safety of staff and students or continue online and suffer disastrous financial consequences,” Ahart said.

After the ruling was announced, King Elementary School Principal Kisha Barnes told NBC that the “powers that be are going to have to … grapple with the moral and ethical response to covid rates and their responsibility to students.”

President Trump has made reopening schools a centerpiece of his coronavirus response, sometimes contradicting or undermining his own public health authorities in his efforts. It’s critical to his effort to restart the economy, which he views as central to his reelection bid.

Many of his allies are trying to fulfill his pledge, pressing local school systems, even those in coronavirus hot spots, to reopen, disregarding public health guidance and overruling the wishes of local school boards.

Reynolds, a close ally of President Trump’s, has forced schools across the state to reopen.

The state, for example, has required schools to remain open unless their positivity rate — the percentage of positives among those tested for the novel coronavirus — reaches 15 percent. That’s triple what public health officials recommend. Robert Redfield, the director of the Centers for Disease Control and Prevention, also has said that when the rate remains above 5 percent, schools may have to keep schools closed for face-to-face instruction.

Polk and Warren counties, where Des Moines public schools are located, both exceed that threshold.

The school system will continue to conduct nearly all classes online. Its school board meets Wednesday to determine how to proceed.

Valerie Strauss contributed to this report.