Mayor Bill de Blasio called President Donald J. Trump's executive order calling for jurisdictions that protect undocumented immigrants to lose federal funding "vague" and said the city will sue if the government tries to enforce it. View Full Caption DNAinfo/Jeff Mays

CITY HALL — Mayor Bill de Blasio said Wednesday the city will sue the federal government if it tries to enforce President Donald Trump's executive order calling for sanctuary cities to lose federal funding.

"We're going to defend all of our people, regardless of where they come from and regardless of their documentation status," de Blasio said at a City Hall press conference about Trump's executive order calling for sanctuary cities to lose federal funding.

►READ MORE: New York Could Lose Billions as Trump Attacks Sanctuary Cities

Sanctuary cities are jurisdictions where cooperation with federal immigration authorities is limited. In New York City, undocumented immigrants are also allowed access to some social services without having to reveal their status. Some estimate there are 300 or more sanctuary jurisdictions in the country.

The city does have a list of 170 crimes and offenses for which it will cooperate with federal deportation authorities.

"We already remove the worst criminals from New York," said NYPD Commissioner James O'Neill.

Trump, in a visit Wednesday to the Department of Homeland Security in Washington, D.C., referenced families who were the victims of crimes by undocumented immigrants.

"We are going to restore the rule of law in the United States," Trump said.

De Blasio said New York City would be made less safe if it removed its sanctuary city policy because undocumented immigrants would not cooperate with the police.

The loss of federal funding, which pays for things such as anti-terrorism efforts, would also leave the city more vulnerable, the mayor said.

"This executive order could in fact undermine public safety," said de Blasio.

The mayor says he talked about the 170 offenses for which the city does cooperate with federal authorities for deportation during his Nov. 16 meeting with Trump and U.S. attorney general nominee Jeff Sessions.

► READ MORE: New Yorkers Are Scared of You, De Blasio Tells Trump

"I said: 'Here is an example of a middle ground that works,'" said de Blasio, adding that the list of offenses "covers everything conceivable in terms of serious and violent crime."

"I said this is a model, and I know other cities have similar programs, that could address the fair concerns people have about those who commit serious crimes, but respect millions of others who are part of the fabric of our communities,'" the mayor said he told Sessions and Trump.

New York City has an estimated 500,000 undocumented immigrants.

Corporation Counsel Zachary Carter, a former U.S. attorney, said there is U.S. Supreme Court precedent that "the federal government can't use the threat of withholding funds to coerce the states to conform with federal government issued policy."

It's an opinion shared by state Attorney General Eric Schneiderman, who said in a statement that Trump does not have the "constitutional authority" to cut funding from cities that have lawfully acted to protect immigrants.

New York City receives billion in federal funding for things such as counterterrorism and intelligence, affordable housing, and HIV/AIDS prevention. For fiscal year 2017, the city is expecting $8.8 billion in federal aid.

A paragraph in the executive order specifies that jurisdictions that don't comply, shall be deemed "not eligible to receive federal grants ... except as deemed necessary for law enforcement purposes."

Carter called the clause "more gesture than legal force." He said the only funding that may be in jeopardy is police funding because it is relevant to the executive order as per legal precedent.

O'Neill said the NYPD estimates about $150 million to $160 million in federal funding might be at stake. The money is used for overtime on details to protect the United Nations, transit protection task forces and radiological and bomb detection.

Another clause calls for state and local police "to perform the functions of immigration officers in relation to the investigation, apprehension, or detention of aliens" in the country.

De Blasio said the NYPD won't be complying with that clause either.

►READ MORE: 'We Have Your Back,' De Blasio Promises Undocumented Immigrants

"We are not going to allow our police officers to be used as immigrant enforcement agents," said the mayor.

Another section of the order calls for publishing a weekly list of crimes allegedly committed by undocumented immigrants and jurisdictions who fail to comply with federal detainee orders to "better inform the public regarding the public safety threats associated with sanctuary" cities.

City Council Speaker Melissa Mark-Viverito said Trump's executive order is based on the "false narrative that immigrants, all immigrants, are criminals," she said.

"So what President Trump seems to forget is that America is a nation of immigrants," added Mark-Viverito.

Rep. Joe Crowley said the executive orders, which includes one about building a wall along the Mexican border, "scares the daylight out of me."

He called the sanctuary city executive order a "cheap political stunt" that "makes us vulnerable to a terrorist attack."

The $84.67 billion city budget that de Blasio introduced Tuesday did not have any "Trump-specific adjustments" but the city prepared for the possibility of losing federal funds by bolstering its reserves to more than $5 billion, the highest amount ever.

►READ MORE: Mayor's $84B Budget Braces New York For Trump Attack on Sanctuary Cities

There is $1 billion in the general fund and $4 billion in the retiree health care fund along with another $250 million in the capital reserves. All of that money can be tapped in an emergency, said de Blasio.

But the city, along with other sanctuary cities and states, will fight any effort to cut federal funds, said de Blasio.

"This executive order does not change who we are. This executive order will not change how we enforce the law," said the mayor.