Attorney General Jeff Sessions says the Justice Department will withhold grant money from sanctuary cities during a White House briefing, March 27, 2017. Jonathan Ernst

UPDATE: 7:50 p.m. EDT — New York Mayor Bill de Blasio reacted to the attorney general’s threat, calling the Trump administration’s plan to punish sanctuary cities “mean spirited.” De Blasio said he will fight the action in court.

Original story

The Justice Department will withhold grants from cities that refuse to detain violators in the U.S. illegally for immigration officials, Attorney General Jeff Sessions said Monday.

The announcement came just days after the administration suffered its first major legislative defeat with its failure to gain approval of the Republican measure to repeal and replace the Affordable Care Act, aka Obamacare, and as the White House tried to get its agenda back on track.

Read: San Francisco Calls President Trump's Executive Order On Sanctuary Cities Un-American

In a surprise appearance in the White House briefing room, Sessions told reporters so-called sanctuary cities “make our nation less safe by putting dangerous criminals back on the streets.”

“The American people are justifiably angry,” Sessions said. “They know that when cities and states refuse to help enforce immigration laws, our nation is less safe. Failure to deport aliens who are convicted for criminal offenses puts whole communities at risk – especially immigrant communities in the very sanctuary jurisdictions that seek to protect the perpetrators.”

The Trump administration has pledged to crack down on immigrants in the U.S. illegally and threatened to withhold federal funds from jurisdictions that don’t cooperate with detention orders. During the presidential campaign, Donald Trump frequently appeared with people whose family members had been killed by individuals in the nation illegally and promised to crack down on sanctuary cities. Just days after his inauguration, Trump signed an executive order designed to pressure sanctuary cities.

Read: Does Immigration Cause Crime?

“Today, I am urging states and local jurisdictions to comply with these federal laws,” Sessions said.

The Justice Department’s Office for Justice Programs provides billions of dollars to local criminal justice initiatives, and Sessions said the administration would “claw back” funds from cities that fail “to comply and certify compliance” with immigration detention orders and block them from receiving funds in the future.

“Unfortunately, some states and cities have adopted policies designed to frustrate the enforcement of our immigration laws,” Sessions said. “This includes refusing to detain known felons under federal detainer requests, or otherwise failing to comply with these laws.”

This year, the Office of Justice Programs and Community Oriented Policing Services likely will award more than $4.1 billion.

“I urge our nation’s states and cities to consider carefully the harm they are doing to their citizens by refusing to enforce our immigration laws, and to re-think these policies,” Sessions said. “Such policies make their cities and states less safe, and put them at risk of losing valuable federal dollars.”

The announcement came as Maryland considered whether to adopt a statewide sanctuary stance and other cities doubled down on their sanctuary status.

San Francisco has sued the federal government for threatening to withhold federal funds, calling the adminsitration’s position un-American and unconstitutional. There are more than 400 sanctuary cities, including New York, Chicago and Los Angeles.

There are some 11 million people living in the United States illegally, and Trump has estimated as many as 3 million of them have criminal records or are tied to gangs and/or drug trafficking.

The U.S. Conference of Mayors and the Major Cities Chiefs Association issued a statement earlier this year urging the administration to rethink its position on sanctuary cities, saying the fear created by federal detention orders will undermine safety, not enhance it.

“Local police departments work hard to build and preserve trust with all of the communities they serve, including immigrant communities. Immigrants residing in our cities must be able to trust the police and all of city government,” the statement said.