A federal judge in New York on Friday barred the Justice Department from withholding law-enforcement grants from states and cities that don’t cooperate with federal immigration authorities.

The ruling is the latest development in a continuing battle between the Trump administration and so-called sanctuary jurisdictions over compliance with federal immigration policy. Earlier this year, seven states and New York City sued the Justice Department, arguing they were being unfairly denied grant funds for refusing to give certain details about illegal immigrants to the federal government.

On Friday, U.S. District Judge Edgardo Ramos ordered the Justice Department to allow the plaintiffs—New York, Connecticut, New Jersey, Rhode Island, Washington, Massachusetts, Virginia and New York City—to receive the funds without complying with immigration conditions. The judge said the states would have collectively received more than $25 million in grants.

“Consistent with every other court that has considered these issues, the Court concludes that Defendants did not have lawful authority to impose these conditions,” Judge Ramos wrote.