A federal judge has sided with the city of Chicago and denied a motion to dismiss three key counts of the city’s lawsuit against U.S. Attorney General Jeff Session over the Justice Department’s attempt to tie a law enforcement grant to new immigration enforcement requirements, including giving federal agents access to municipal jails.

In an order signed Thursday, U.S. District Judge Harry Leinenweber granted the city’s motion for a summary judgment on the first two counts of the suit — which argued that the Justice Department was overstepping its legal authority — and denied a motion by Sessions to dismiss those counts.

“Today’s opinion in favor of Chicago and against the Trump Justice Department marks a major win for all Chicagoans and a significant victory for public safety,” Mayor Rahm Emanuel said in a written statement Friday.

“Welcoming immigrants, refugees and dreamers from every corner of the globe is part of Chicago’s history, and part of our future, no matter which way the political winds are blowing in Washington.”

The city sued Sessions last August, after the U.S. Department of Justice ordered Chicago and other sanctuary cities to give 48-hours notice before releasing undocumented immigrants from custody; to allow immigration agents access to jails; and to share citizenship information with the federal government, the Chicago Sun-Times reported previously.

Sessions warned the city that if they didn’t comply with his orders, the city would not be eligable for Edward Byrne Memorial Justice Assistance Grants — a leading source of federal law enforcement grant funding.

The city argued that their longstanding “Welcoming City” policy protects Chicagoans and leads to reductions in crime. Further, the city argued that forcing officials to comply with Sessions order would force the city to detain people for longer than was justified by probable cause and was unconstitutional.

Last September, Leinenweber sided with Chicago and issued a preliminary injunction against the Justice Department barring cities from receiving the yearly grant based on their cooperation with immigration agents.

Friday’s order from Leinenweber effectively made the preliminary injunction entered in September into a permanent injunction, the city said in its statement.

When Leinenweber handed down the injunction, the order had national implications. In his decision, Leinenweber said the injunction applied nationwide because there is “no reason to think that the legal issues present in this case are restricted to Chicago.”

However, last month the 7th U.S. Circuit Court of Appeals ruled to limit the injunction only to Chicago. The limitation will be in effect until the full appeals court weighs in on whether the injunction should apply nationwide, according to the court’s order.

Arguments are set for Sept. 6.