Jeff Sessions. Thomson Reuters So-called "sanctuary cities" are bracing themselves for a prolonged battle with the Trump administration after Attorney General Jeff Sessions on Monday said the federal government will withhold grants from jurisdictions that violate immigration law.

City officials and mayors across the country did not take kindly to the threat, and some pledged to defend their policies even if that means a loss in funding.

"If they want a fight, we'll see them in court," New York City Mayor Bill de Blasio tweeted on Monday.

"I'm willing to risk losing every penny of federal funding to stand by our commitment to protect everyone in our community," Seattle Mayor Ed Murray said in a statement.

Cities such as San Francisco, Seattle, Denver, Chicago, and Philadelphia, will "become this administration's worst nightmare," New York's city council speaker Melissa Mark-Viverito said during a Monday gathering of officials from those jurisdictions, the Associated Press reported.

The Department of Justice will require cities to certify compliance with a specific federal law before they are awarded any of the $4.1 billion available in federal grants, Sessions said during the White House daily press briefing on Monday.

"I strongly urge our nation's states and cities and counties to consider carefully the harm they are doing to their citizens by refusing to enforce our immigration laws, and to rethink these policies," he said.

Yet self-proclaimed "sanctuary cities" see the issue differently, arguing that such policies more effectively fight crime and preserve public safety. Several mayors and prosecutors across the country have reported in recent months that undocumented immigrants are increasingly avoiding law enforcement, refusing to report crimes or testify in court cases out of fear they'll be targeted for deportation.

'"Sanctuary cities" are already in full compliance'

President Donald Trump signs an executive order for border security and immigration enforcement improvements, Wednesday, Jan. 25, 2017, at the Homeland Security Department in Washington. Associated Press/Pablo Martinez Monsivais Sessions' warning comes just two months after President Donald Trump signed an executive order outlining the administration's plans to cut grant funding to sanctuary cities and issue weekly lists of jurisdictions that refused to comply with federal requests to detain undocumented immigrants.

Dozens of cities have now filed "friend of the court" briefs supporting a San Francisco lawsuit filed last month that challenges Trump's order.

Yet the specific law Sessions accused cities of violating is 8 USC 1373, which ensures that information on individuals' citizenship or immigration statuses can be requested, obtained, and exchanged between federal, state, and local government entities.

As city officials across the country have since noted, many of the jurisdictions Sessions threatened to withhold funding from say they already abide by 8 USC 1373 and have done so for years.

"As we've said many times before, these so-called 'sanctuary cities' are already in full compliance with federal immigration law, and have committed no violation of the US code," Matt Zone, president of the National League of Cities, said in a statement.

"This is not new," Tom Cochran, executive director of the US Conference of Mayors, said in a statement. "Last year the department began requiring such compliance under several key programs." He added that city leaders across the country are already committed to complying with federal laws and ensuring that criminals are prosecuted regardless of their immigration status.

Some cities were also quick to point out that the federal government hasn't been effective in enforcing its own immigration laws — the Immigration and Customs Enforcement agency has failed at times to issue timely warrants or detainer requests for people suspected of violating immigration laws, and has also failed to act after being notified by cities of prisoners' releases.

In his remarks on Monday, Sessions singled out Denver, Colorado, as an example of a city that flouted a federal request to detain a man who was known to ICE officials. The man allegedly killed and robbed a man just two months after he was released from a Denver jail.

The Denver mayor's office fired back on Monday, calling Sessions' account "incorrect." ICE neither issued a federal detainer request nor obtained a warrant while the suspect was in jail — it requested notification of the prisoner's release, which was provided, spokeswoman Amber Miller told The Denver Post.