CHICAGO — Attorney General Jeff Sessions cannot follow through, for now, with his threat to withhold public safety grant money to Chicago and other so-called sanctuary cities that have refused to impose tough new immigration policies, a federal judge ruled Friday.

In what is at least a temporary victory for cities nationwide that have defied Mr. Sessions, Judge Harry D. Leinenweber of the United States District Court for the Northern District of Illinois ruled that Chicago had shown a “likelihood of success” in arguing that Mr. Sessions exceeded his authority when he set the conditions. Among them are requirements that cities notify immigration agents when people who are in the country illegally are about to be released from local jails.

The City of Chicago had asked Judge Leinenweber for a “nationwide” temporary injunction this week, asking him not to allow the Justice Department to impose the requirements until the city’s lawsuit against the department was complete.

City officials have said such a ruling would prevent the Justice Department from withholding the public safety funds, called Edward Byrne Memorial Justice Assistance Grants, to the cities based on their refusal to comply with the department’s orders.