CHICAGO (Reuters) - Chicago on Monday sued to prevent the Trump administration from enforcing new policies that would withhold money from so-called sanctuary cities that deny U.S. immigration officials access to local jails.

FILE PHOTO - Chicago Mayor Rahm Emanuel listens to remarks at a news conference in Chicago, Illinois, U.S. on December 7, 2015. REUTERS/Jim Young/File Photo

The lawsuit, filed in U.S. District Court, said the federal policies force the nation’s third largest city to choose between its constitutional rights and funding for law enforcement.

“These new conditions also fly in the face of longstanding City policy that promotes cooperation between local law enforcement and immigrant communities,” the lawsuit said.

The policies also include a requirement that local law enforcement agencies give federal authorities 48 hours notice before releasing anyone wanted for immigration violations.

Democratic Mayor Rahm Emanuel said on Sunday that the city would sue, escalating a pushback against an immigration crackdown launched by Republican President Donald Trump’s administration.

“We are bringing this legal challenge because the rhetoric, the threats from this administration embodied in these new conditions imposed on unrelated public safety grants funds are breeding a culture and climate of fear,” Emanuel’s senior legal adviser, Corporation Counsel Ed Siskel, said on Monday.The conditions from the Justice Department apply to the Edward Byrne Memorial Justice Assistance Grants, which provide money to hundreds of cities. Chicago is expected to receive $3.2 million this year for purchasing equipment.

Siskel said the city will follow the initial complaint with a motion for a preliminary injunction to halt the government’s imposition of the new conditions.

The city will request a decision from the judge before the Sept. 5 deadline to apply for the Byrne grant, Siskel said.

U.S. Attorney General Jeff Sessions said on Monday that Chicago officials have shown an “open hostility” to enforcing laws designed to reduce crime and protect law enforcement.

He added that more Chicagoans were murdered last year than residents of Los Angeles and New York combined, and that Chicago needed to reverse a “culture of lawlessness.”

“This administration will not simply give away grant dollars to city governments that proudly violate the rule of law and protect criminal aliens at the expense of public safety,” Sessions said in a statement.

The lawsuit is the first to challenge the Justice Department over the Byrne program but is not the first legal attack on the administration’s sanctuary city policies.

Emanuel said on Sunday that the lawsuit would prevent the administration from setting a precedent that could be used to target other funding.

Sanctuary cities in general offer illegal immigrants safe harbor by declining to use municipal resources to enforce federal immigration laws. Dozens of local governments and cities, including New York and San Francisco, are part of the sanctuary movement. “Sanctuary city” is not an official designation.

The lawsuit came nearly two weeks after Sessions said the Justice Department would bar cities from the Byrne program unless they allowed immigration authorities unlimited access to local jails and give the 48 hours pre-release notice.

Chicago and its high murder rate have been frequently criticized by Trump, and cracking down on illegal immigration was a theme of his 2016 presidential campaign.