CHICAGO (AP) — Mayor Rahm Emanuel has taken his fight against President Donald Trump’s immigration policies to court, with Chicago becoming one of the first cities Monday to sue over what many U.S. cities argue are illegal bids to withhold public safety grants from so-called sanctuary cities.

Hours later, Attorney General Jeff Sessions hit back at Chicago, saying the Trump 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.”

“So it’s this simple: Comply with the law or forego taxpayer dollars,” he said in a toughly worded statement.

A 46-page lawsuit, which names Sessions, was filed earlier Monday in U.S. District Court in Chicago a day after Emanuel announced the litigation and said the city won’t “be blackmailed” into changing its values as a city welcoming of immigrants.

It’s the latest round in a battle pitting several U.S. cities against the Trump administration. The cities have opted to limit cooperation with government enforcement of immigration law while federal officials threaten to withhold funding if those cities don’t comply.

While estimates vary, there are thought to be about300 jurisdictions — including cities and counties — with sanctuary-like policies. Among the other the bigger U.S. cities with such policies are New York and Philadelphia.

A first order of business now that Chicago’s suit has been filed will be to ask a judge to put a freeze on the policy as the civil case plays out, said Edward Siskel, the head of City Hall’s legal department. That request for a preliminary injunction could be made within days.

Chicago has received the grant funds at the heart of the lawsuit since 2005. It spent $33 million in grants to buy nearly 1,000 police cars in that 12-year period; it got $2.3 million last year. In addition to cars, funds were also used for radios and SWAT equipment.

While the grant money amounts to a fraction of Chicago’s public safety budget, Emanuel has said fighting the government now could help prevent the withholding of more money later. He described the Trump measures so far as just “the camel’s nose under the tent.”

In his Monday statement, Sessions said Chicago stood out in its “open hostility” to enforcing immigration laws.

“To a degree perhaps unsurpassed by any other jurisdiction, the political leadership of Chicago has chosen deliberately and intentionally to adopt a policy that obstructs this country’s lawful immigration system,” he said.

Chicago’s suit focuses on new conditions set by Sessions for cities to qualify for grant money. They include the sharing immigration-status records with federal agencies, providing 48-hours notice of a detainee’s release if immigration violations are suspected and giving federal agents unfettered access to jails.

“The government,” the lawsuit says, can’t “unilaterally” set new conditions that weren’t approved by Congress “and that would federalize local jails and police stations, mandate warrantless detentions in order to investigate for federal civil infractions, sow fear in local immigrant communities, and ultimately make the people of Chicago less safe.”

Chicago’s sanctuary policies date back to the mid-1980s and successive city councils have confirmed or expanded the protections.

The city prohibits police from providing federal Immigration and Customs officials access to people in police custody, unless they are wanted on a criminal warrant or have serious criminal convictions. Local police are also barred from allowing ICE agents to use their facilities for interviews or investigations and from responding to ICE inquiries or talking to ICE officials about a person’s custody status or release date.

City authorities say the policies help encourage residents of the immigrant community to inform police when they are victims of crimes.

“If Chicago submits to the Department’s demands, it will forfeit decades’ worth of trust and goodwill that its police force has built in the communities it serves,” the new lawsuit argues. “And as those decades of experience show, that kind of trust, once lost, is lost forever.”

Sessions alluded to arguments also made by Trump that enforcing immigration laws can reduce crime. He calls Chicago’s “hostility” to such laws especially “astounding” given that numbers of homicides in the city in 2016 outpaced the numbers in New York and Los Angeles.

“The city’s leaders cannot follow some laws and ignore others and reasonably expect this horrific situation to improve,” Sessions said.

He also characterized Emanuel as complaining it would have to reorder longstanding policies to conform.

“But that’s just what Chicago needs: a recommitment to the rule of law and to policies that rollback the culture of lawlessness that has beset the city,” Sessions said.

The city’s lawsuit says the Trump administration’s contention that more lenient immigration policies contribute to crime “is divorced from reality.”

In March, the Justice Department sent letters to officials in California and major cities including New York, Chicago, Philadelphia and New Orleans, all places the Justice Department’s inspector general has identified as limiting the information local law enforcement can provide to federal immigration authorities about those in their custody.

The department warned that the administration will punish communities that refuse to cooperate with efforts to find and deport immigrants in the country illegally. But some of the localities remained defiant, despite risking the loss of funds that police agencies use to pay for everything from body cameras to bulletproof vests.

___

Follow Michael Tarm on Twitter at http://twitter.com/mtarm . Follow Sophia Tareen on Twitter at https://twitter.com/sophiatareen .

___

Sign up for the AP’s weekly newsletter showcasing our best reporting from the Midwest and Texas: http://apne.ws/2u1RMfv