A day before the Department of Education had planned to dismiss over 500 school aides, a judge has issued a temporary restraining order preventing the layoffs from going through.

State Supreme Court Justice Carol Edmead ruled today that before the city laid off hundreds of “the most vulnerable employees,” the Court had to ensure that the layoffs did not violate the state’s constitution and the education law.

Officials from DC 37, the union that represents the school aides, argued in court yesterday that the city was laying off civil servants in order to replace them with less expensive temporary workers who are not given health benefits.

They also said that the layoffs would disproportionally affect schools that serve low-income students. According to union officials, the Mosaic Preparatory Academy (P.S. 375), where 90 percent of the students quality for free or reduced lunch, is set to lose all of its school aides. In contrast, P.S. 6, where roughly 6 percent of students are at the poverty line, is hiring 17 teacher aides. A breakdown of the school aide layoffs at each school was not made available.

According to city officials, savings from the layoffs would come to about $13 million.

“The loss of school aides at schools like Mosaic Preparatory Academy (P.S. 375) in East Harlem, which is allegedly a particularly overcrowded school, will have an immediate, irreparable impact upon the safety of New York City school children,” Edmead wrote in her decision.

The union said that the city was adding insult to injury by allowing parent associations to pay for school aides, a battle that parents fought and won this summer. D.C. 37’s lawyers claimed that allowing parent-paid aides gives preference to wealthier school districts while harming schools in poorer districts that are slated to lose more school aides and don’t have parent associations that can afford to pay their own.

“We believe that the lower court decision was in error, and we will be taking an immediate appeal,” said Daniel Gomez-Sanchez, a lawyer for the city. The Department of Education refused to comment.