A federal judge in Chicago has ruled Attorney General Jeff Sessions can't withhold public grant money from so-called sanctuary cities for refusing to follow federal immigration policies.

U.S. District Judge Harry Leinenweber made the ruling Friday, in which he granted Chicago's request for a temporary "nationwide" injunction.

The ruling means the Justice Department cannot deny grant money requests until Chicago's lawsuit against the agency is concluded. Leinenweber wrote that Chicago has shown a "likelihood of success" in its arguments that Sessions overstepped his authority with the requirements.

The city of Chicago sued the Trump administration in August after it threatened to withhold funds from sanctuary cities, and refused to comply with the Justice Department's demand that it allow immigration agents access to local jails and notify agents when someone in the U.S. is about to be released from custody.

SANCTUARY CITIES: WHAT ARE THEY?

At least seven cities and counties, including Seattle and San Francisco, as well as the state of California, have refused to cooperate with new federal rules regarding sanctuary cities.

The ruling is another blow to Sessions, a longtime champion of tougher immigration laws.

Earlier this month, Sessions announced that the administration would end Deferred Action for Childhood Arrivals (DACA), a program that protects young immigrants who were brought to the U.S. illegally as children or came with families who overstayed their visas.

President Trump later announced he was working on an agreement to protect them.

It's unclear whether the ruling means the Leinenweber will ultimately decide in favor of the city.

The Associated Press contributed to this report.