Updated at 6 p.m.

The City of Boston did not break its contract with the Boston Teachers Union when it required in-person teaching for special needs students citywide as COVID-19 rates rose, a Suffolk Superior Court judge ruled Wednesday.

Judge Robert B. Gordon said although the union’s contract included language allowing teachers to work remotely when the citywide infection rate surpassed 4 percent, the contract also gave the Boston Public Health Commission the authority to determine whether schools were safe for teachers.

“The court is acutely cognizant of the health risks posed by the pandemic,” Gordon wrote, “but it cannot agree with the contention posed by the BTU that a COVID-19 positivity rate of 4 percent represents some kind of stipulated acknowledgement by the parties that on-site learning is per se unsafe.”

The union’s contention also threatened to substantially disrupt the operations of the Boston Public Schools, the ruling said, by “forcing high need and routine-dependent students who have been receiving services at school [to] be abruptly returned home.”

The 21-page ruling also noted other factors that reduced the risk to teachers. It said the number of special needs students attending Boston schools on any given day is about 1,300, or half the overall special needs population slated to be in schools, because they are on a hybrid, two-day a week in-person schedule. That means on average, about nine students are inside Boston school buildings daily.

Tensions between the union, Mayor Marty Walsh and Superintendent Brenda Cassellius flared last week when the Boston Teachers Union sued the city last week to block Boston Public Schools from reopening in-person and requiring educators to return to classrooms.

Gordon said at Wednesday’s hearing that the teachers' contract offered conflicting language, allowing teachers to work remotely if rates rose over 4 percent, but in the next sentence, stipulating that if the Boston Public Health Commission determines that a school can reopen, "BTU bargaining unit members will be expected to return to BPS buildings."

“There’s what the teachers say is the irreparable harm caused by COVID-19 and the exposure to a heightened risk of virus transmittal,” Gordon said, “versus the school’s vision of irreparable harm, which is kids being thrown into a muddle, these learners being ping-ponged around between their schools and their homes and for whatever period of time forced to “learn from home” when everyone understands, including the union here, that for most of those kids in-home learning will mean no learning at all.”

Gordon said he had also received a statement from a group of Boston parents of special needs students who expressed their desire for their children to remain in school.

Just before the hearing ended, a lawyer for the teachers’ union added another factor for the judge to consider: the Boston Public Health Department had just announced that the citywide virus rate rose to 4.4 percent.