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 the government over what many U.S. cities argue are illegal bids to withhold public safety grants from so-called sanctuary cities.

The 46-page lawsuit was filed 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 welcoming city. He argued it's unconstitutional for a city "to be coerced on a policy."

A first order of business now that the suit has been filed will be to ask a judge to put a freeze on the policy at least until 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 officials say there are new qualifications for a grant that requires cities to share information with U.S. immigration authorities, which they allege are unconstitutional. Chicago has received the grant funds since 2005, including $2.3 million last year. They were used for buying police vehicles, radios and SWAT equipment.

"These new conditions — which would give federal officials the power to enter city facilities and interrogate arrestees at will and would force the City to detain individuals longer than justified by probable cause, solely to permit federal officials to investigate their immigration status — are unauthorized and unconstitutional," the complaint read. "These new conditions also fly in the face of longstanding City policy that promotes cooperation between local law enforcement and immigrant communities, ensures access to essential city services for all residents, and makes all Chicagoans safer."

Those grant amounts of money are relatively small, but Chicago leaders say they fear more impactful restrictions could be coming and so they hope to establish in court that such government measures are illegal.

It is the latest round in a battle between several major U.S. cities that opt to limit cooperation with federal government efforts to enforce immigration law and the Trump administration, with federal officials threatening for months to withhold funding for sanctuary cities, saying they don't comply with federal laws.

Last month, Attorney General Jeff Sessions said local governments would lose the money if they do not give advance notice when immigrants in the country illegally are about to be released from custody. He also wants immigration agents to have access to local jails. He has argued that the policy makes everyone safer.

Chicago has been a sanctuary city since the 1980s, beefing up its policies in the past decade, particularly since Trump took office.

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.

Authorities contend the policy helps encourage residents of the immigrant community to inform police when they are victims of crimes.

The lawsuit, which names Sessions, seeks to remove the immigration-related conditions for the grant applications.

When asked for comment about the lawsuit Monday, the Department of Justice spokesman directed The Associated Press to Sessions' previous comments, including those saying sanctuary cities threaten safety. "It's especially tragic that the mayor is less concerned with that staggering figure than he is spending time and taxpayer money protecting criminal aliens and putting Chicago's law enforcement at greater risk," said department spokesman Ian D. Prior in an email.

Emanuel and other city leaders have rejected that the city's policies protect immigrants with criminal records who are living in the U.S. without legal permission. Leaders of several sanctuary cities and counties, including in Chicago, have also dismissed such statements linking immigrants and crime as discriminatory and misleading.

"The rhetoric and the threats from this administration embodied in these new conditions imposed on unrelated public safety grant funds are breeding a culture and a climate of fear within the communities in our city," said Siskel, the law office director, said at the courthouse after the lawsuit was filed.

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 .