A Manhattan federal judge has vacated the Trump administration’s move to halt magnet school grants to New York City over its policies for transgender students.

Judge Arun Subramanian in a 10-page order Wednesday said the U.S. Department of Education failed to follow the procedures of Title IX — the federal civil rights law prohibiting discrimination on the basis of sex — and that it “strains credulity” to argue they do not apply in this case.

“It is undisputed both that defendants did not follow these statutory procedures, and that the procedures would apply if they non-continued the grants because of Title IX violations,” Subramanian wrote.

The judge said the Trump administration’s written back-and-forth with local education officials “makes clear that the alleged violations were violations of Title IX,” he wrote. “It thus strains credulity to argue that the DOE’s actions were anything other than an effort to enforce Title IX.”

The Trump administration discontinued tens of millions of dollars in grant funding last fall, alleging school policy allowing transgender students to use the bathroom or play on sports teams aligning with their gender identity violated federal civil rights law. The grants included $11 million in carryover funds, which were restored earlier in the legal battle, and $36 million in future funds through the end of the grant period.

New York City Public Schools sued the U.S. Education Department over the loss of those funds, accusing the feds of illegally trying to coerce the city into changing its policies.

The Trump administration’s lawyers tried to argue that the grants were discontinued as part of a separate process and therefore did not need to follow the procedures outlined in Title IX, which include interim steps, like a report or a hearing.

While the order represents a victory for the city’s public schools, and Subramanian said the court would be closing the case, the dispute over the system’s gender policy seemed likely to continue.

Subramanian directed the Education Department to make a new determination within 10 days about whether to continue the grants. The judge also declined to weigh in on whether city or federal officials were right about the guidelines violating Title IX or not.

“The Court cannot — and does not — order defendants to expend any funds to NYCPS or to renew the grants,” Subramanian wrote. “Instead, NYCPS is entitled only to vacatur.”

Spokespeople for the city and federal education departments did not immediately return a request for comment.