Attorney General Jeff Sessions' attempt to withhold federal grant money from so-called sanctuary cities has been blocked by a federal judge.

On Friday, U.S. District Judge Harry Leinenweber in the Northern District of Illinois ruled in favor of the city of Chicago in its request for a preliminary injunction against Session's conditions for Edward Byrne Memorial Justice Assistance Grants.

The ruling will now apply to sanctuary jurisdictions nationwide.

"The court finds that the city has established that it would suffer irreparable harm if a preliminary injunction is not entered," Leinenweber said in his order, adding the injunction is "nationwide in scope" because there is "reason to think that the legal issues present in this case are restricted to Chicago."

Chicago argued that the new conditions that mandated cities allow immigration agents into jails, as well as having to give at least a 48-hour notice before releasing someone suspected of immigration violations, were unconstitutional.

Chicago would have lost $2.3 million in grant money the next fiscal year by refusing to comply with the new conditions.