The Trump administration officially put sanctuary cities on notice Monday that they are violating federal laws and could lose access to billions of dollars in Justice Department grants if they continue to thwart efforts to deport illegal immigrants.

And counties and cities that have taken money in the past, despite refusing to cooperate with federal agents, could have that money clawed back, Attorney General Jeff Sessions said. That would mean Chicago, Philadelphia and other prominent sanctuaries would not only lose money going forward, but might have to pay back tens of millions of dollars from their treasuries.

But Mr. Sessions didn’t say when he would actually start withholding money, making his announcement more signal than substance — and leaving Democrats to argue he was trying to change the subject from White House controversies and the failed Obamacare repeal effort on Capitol Hill.

PHOTOS: 13 Things Liberals Want To Ban

“Countless Americans would be alive today — and countless loved ones would not be grieving today — if the policies of these sanctuary jurisdictions were ended,” Mr. Sessions said from the White House, saying the time is ripe to take action.

Mr. Sessions’ announcement was a reiteration of a policy first announced by the Obama administration last year.

Immigrant rights groups, however, blasted Mr. Sessions, calling him a “bully” and blaming him for poisoning relationships between immigrants and local police.

PHOTOS: See Obama's biggest White House fails

“So-called ‘sanctuary’ jurisdictions have lower crime rates than others, in no small part due to the trust between local law enforcement and the entire community,” said Lynn Tramonte, deputy director of America’s Voice Education Fund.

Sanctuaries have been around for years, but became front-page news in summer 2015, just as President Trump was kicking off his campaign, when Kate Steinle was slain while walking the San Francisco waterfront with her father.

Francisco Sanchez, the man accused of her killing, was an illegal immigrants who had been deported five times and convicted of seven felonies, but who’d just been released months earlier by San Francisco, which defied a request that he be turned over to federal agents.

“Even worse, Sanchez admitted that the only reason he came to San Francisco was because of its sanctuary policies,” Mr. Sessions said Monday.

Mr. Trump has vowed to shame sanctuaries into revoking their policies. In his first set of executive orders on immigration, he demanded Homeland Security compile and release a weekly list of immigrants protected by sanctuaries.

The first list, released last week, showed a convicted arsonist and a murder suspect were among the 200 illegal immigrants released.

Mr. Sessions on Monday said his department will issue some $4 billion in grants this year, and he warned that money won’t go to sanctuaries. Key programs administered by the Justice Department are the Community Oriented Policing Services (COPS) grant, the Byrne grant and the State Criminal Alien Assistance Program (SCAAP), which pays for some of the costs local communities incur for holding illegal immigrants in prison or jail.

Mr. Trump, in his executive orders, proposed going even beyond Justice Department grants. Local communities feared losing everything from Medicaid money to federal education funds.

San Francisco and several other jurisdictions have sued, asking judges to stop the policies from taking effect in the first place.

Immigrant rights lawyers argue they have a case, saying that the federal government cannot use its financial might to force local police to become immigration agents. But the Obama and Trump administrations have both disagreed, saying some funding can be conditioned on cooperation with federal agents.

The Democratic Party on Monday announced its support for sanctuaries, with new Democratic National Committee Chairman Tom Perez saying cities and counties should be free to make their own decisions about policy.

“This administration not only is trying to bully law enforcement and make them ICE agents, but they’re trying to bully immigrant families. This is not who we are as a country,” Mr. Perez said. “We are a country that must protect families from being torn apart, go after criminals to keep our communities safe and support our local law enforcement. Today’s actions do none of that.”

But that stance is in contrast with even the Obama administration, which opposed sanctuary cities. Former Homeland Security Secretary Jeh Johnson said sanctuary policies ended up putting dangerous criminals out on the streets and made the job tougher for his agents, who had to go out into communities to round them up.

It was the Obama administration that laid the groundwork for Mr. Sessions’ announcement.

Under pressure from Rep. John Abney Culberson, Texas Republican, the inspector general released a report in July that affirmed the law requires cities and counties that receive federal money to comply with federal immigration laws — including cooperating with agents in the sharing of information.

The Justice Department then reaffirmed that policy in a notice putting jurisdictions on warning.

Mr. Culberson said Monday he’ll use his position as chairman of the subcommittee that oversees Justice Department funding to make sure sanctuaries don’t have access to law enforcement grant money.

Perhaps most worrisome to cities and counties is the threat to have money they’ve already spent reclaimed from them.

Chicago and Cook County, Illinois, were awarded more than $3.2 million in COPS grants, $1.3 million in SCAAP funds and $1 million in Byrne grants in 2016.

On Friday the Homeland Security Department announced a new policy for “detainers,” which are the official notifications asking for help from local police and sheriffs, who are often the first to encounter illegal immigrants in their communities.

The Obama administration, trying to appease myriad local governments that each had their own set of sanctuary rules, had come up with multiple detainer forms, some of which merely asked to be notified when an illegal immigrant was being released, while others asked local authorities to hold someone for pickup.

The Trump administration said all of those are being consolidated into a single form that both asks for notification and requests an illegal immigrant be held for up to 48 hours for pickup by U.S. Immigration and Customs Enforcement (ICE) officers.

Relatively few jurisdictions object to the notification requirement. But holding illegal immigrants beyond the time they’d normally be released is a bigger problem for many cities and counties, who say their lawyers tell them they could be violating people’s rights by keeping them for longer.

Part of the confusion is the Obama administration’s refusal to weigh in on a series of legal cases challenging detainers.

The National Sheriffs’ Association said the Trump administration needs to issue a stronger statement of policy clearing up the confusion.

“Until the Department of Justice issues legal guidance confirming the constitutionality of current detainers, sheriffs will remain exposed to legal and ethical ramifications,” Jonathan Thompson, executive director of the association, said last week.