WASHINGTON — The Justice Department urged the Supreme Court Monday to trim back a nationwide ruling that blocks the government from punishing sanctuary cities — those that decline to help the federal government enforce immigration laws.

A judge in Chicago was wrong, the Justice Department said, to stop the government from enforcing its policy of denying law enforcement grants to sanctuary cities nationwide. Instead the judge's order should have been limited to granting relief only to Chicago, which filed a lawsuit challenging the policy.

"That sweeping remedy is unjustifiable," the government said in urging the court to act quickly," and it strays far beyond the traditional, proper role of the federal courts."

Though once relatively rare, nationwide injunctions in a variety of cases have become more frequent in recent years. Three years ago, for example, a judge in Texas blocked President Barack Obama from allowing adults who came to the U.S. illegally to stay if they have U.S. citizen children.

For more than a year, Attorney General Jeff Sessions has been turning up the heat on sanctuary cities, telling them they would lose federal crime-fighting grants if their police refused to give immigration authorities advance notice before releasing illegal immigrants from custody or declined to allow immigration agents to visit local jails.

The City of Chicago sued, and federal District Court Judge Harry Leinenweber ruled in September that only Congress, not the attorney general, could impose new restrictions on the federal grants. Federal judges in San Francisco and Philadelphia have also blocked the Justice Department from cutting off federal grants over the sanctuary issue. Those rulings are on appeal.

In the meantime, the Justice Department said, the Supreme Court should limit the Chicago injunction to the city itself.

Aside from the legal issues, the Trump administration and the cities are at odds over the best way to fight crime.

The cities say they need the cooperation of immigrant communities, and if their police are seen as agents of federal immigration authorities, people who are here illegally will be reluctant to report crimes for fear of deportation.

But according to Sessions, "When jurisdictions choose to return criminal aliens to the streets rather than turning them over to federal immigration authorities, they put the public's safety at risk."

Late Monday, the court ordered lawyers for Chicago to respond by Wednesday at 5 p.m.