He said the city had shown a "likelihood of success" in arguing that Sessions exceeded his authority with the new conditions. Among them are requirements that cities notify immigration agents when someone in the country illegally is about to be released from local jails and to allow agents access to the jails.

Chicago Mayor Rahm Emanuel called the ruling a victory for cities, counties and states nationwide and "a clear statement that the Trump administration is wrong."

"It means essential resources for public safety will not come with unlawful strings attached, and the Trump justice department cannot continue to coerce us into violating and abandoning our values," Emanuel said.

The city had asked the judge for a "nationwide" temporary injunction this week, asking the judge not to allow the Justice Department to impose the requirements until the city's lawsuit against the department plays out in court.

City officials have said such a ruling would prevent the Justice Department from withholding what are called Edward Byrne Memorial Justice Assistance Grants to the cities based on their refusal to take the steps Sessions ordered.

Chicago has applied for $2.2 million in the federal grant money - $1.5 million for the city and the rest for Cook County and 10 other suburbs. But in a recent court hearing, attorneys representing the city said that more than 30 other jurisdictions across the United States filed court briefs supporting Chicago's lawsuit and have up to $35 million in grants at stake. At least seven cities and counties, including Seattle and San Francisco, as well as the state of California, are refusing to cooperate with the new federal rules.

Though the $1.5 million is just a tiny fraction of the city's budget, the ruling could be a major victory for a city that has been in a public fight with Sessions. Mayor Rahm Emanuel has said the city would not "be blackmailed" into changing its values as a city welcoming of immigrants, and Sessions responded that the Trump administration would not "simply give away grant money to city governments that proudly violate the rule of law and protect criminal aliens at the expense of public safety."

The city argued that it would suffer "irreparable harm" if it lost the funds that are earmarked to expand the city's use of "ShotSpotter " technology to detect when someone fires a gun. And it has made a similar argument if the city were to follow the new requirements. Doing so, Emanuel said Friday, would "drive a wedge of distrust" between the immigrant community and the police force, which needs that community to trust police enough to come forward to report crimes and help officers solve them.

The judge agreed, saying, "The harm to the City's relationship with the immigrant community if it should accede to the conditions is irreparable," wrote the judge.

The ruling is another blow to Sessions, a longtime champion of tougher immigration laws. Earlier this month, Sessions announced that the administration would end a program that protects young immigrants who were brought to the U.S. illegally as children or came with families who overstayed their visas. Trump later announced he was working on an agreement to protect them.

Whether or not the ruling means that Leinenweber will ultimately decide in favor of the city is unclear, but he did make clear the city has a good case.

During a hearing, Ron Safer, an attorney representing the city, said that if the Justice Department prevailed, it could use the same argument to "seize" even more authority to tie grant money to doing what he wants.

On Friday afternoon, Emanuel declined to speculate on whether the Trump administration would find another rationale to deny the city the grant - something that has never happened. Nor would he say if he thought that the administration would find another way to punish the city, such as pull the 20 Alcohol, Tobacco, Firearms and Explosives agents that were recently assigned to the city this year as part of a new Chicago Crime Gun Strike Force.