CHICAGO (CBS) — A federal appeals court has upheld a nationwide injunction preventing the Trump administration from withholding public safety grant funds from Chicago and other so-called sanctuary cities.

Last year, U.S. District Judge Harry Leinenweber ruled U.S. Attorney General Jeff Sessions and the Justice Department could not deny requests for law enforcement grants from cities that refused to comply with strict immigration policies, such as allowing federal agents access to local jails.

Leinenweber ruled Chicago showed a likelihood of success in its arguments Sessions overstepped his authority by requiring local governments comply with the Trump administration’s immigration policies in order to receive federal law enforcement grants.

The appeals court ruled the Justice Department effectively usurped Congress’ authority to determine how and when federal funds are allocated. The ruling noted Congress repeatedly refused to require state and local governments to comply with federal immigration policies in order to receive the law enforcement grants at issue.

“If the Executive Branch can determine policy, and then use the power of the purse to mandate compliance with that policy by the state and local governments, all without the authorization or even acquiescence of elected legislators, that check against tyranny is forsaken,” U.S. Circuit Judge Ilana Rovner wrote in the 7th Circuit ruling. “The Attorney General in this case used the sword of federal funding to conscript state and local authorities to aid in federal civil immigration enforce‐ ment. But the power of the purse rests with Congress, which authorized the federal funds at issue and did not impose any immigration enforcement conditions on the receipt of such funds.”

Mayor Rahm Emanuel praised the court’s ruling Thursday afternoon, saying city officials would not allow the Trump administration to bully or coerce Chicago into changing its immigration policies.

Chicago has refused to comply with the Justice Department’s demand that immigration agents be given access to local jails, and that the city notify the feds when an undocumented immigrant is about to be released from custody.

Leinenweber’s injunction prevents the Justice Department from imposing its restrictions on any sanctuary cities in the U.S., not just Chicago.

Sessions has blamed “sanctuary city” policies for crime and gang violence; but defenders of sanctuary city practices say they improve public safety by promoting trust among law enforcement and immigrant communities, and reserving scarce police resources for more urgent crime-fighting needs.

Chicago’s “Welcoming City Ordinance” protects undocumented immigrants from being held for immigration authorities, unless they have been convicted of a serious crime or are being sought on a criminal warrant. The ordinance also prohibits Chicago police from allowing U.S. Immigration and Customs Enforcement agents from using city facilities for interviews or investigations, and bars officers from replying to ICE inquiries or speaking to ICE officials about someone’s custody status or release date.