Fresh from his impeachment acquittal by Senate Republicans, President Trump has shifted into payback mode.

In his combative State of the Union address Tuesday, Mr. Trump launched a broadside against one of his favorite targets: “sanctuary cities,” those jurisdictions that limit cooperation between local law enforcement and federal immigration officials.

“In sanctuary cities, local officials order police to release dangerous criminal aliens to prey upon the public instead of handing them over to ICE to be safely removed,” Mr. Trump claimed, falsely, speaking of the Immigration and Customs Enforcement agency. He singled out New York and California for particular contempt, spinning nightmarish tales of violent crimes he attributed to those states’ liberal immigration laws. And he touted legislation that would allow the victims of crimes committed by certain foreign nationals to sue sanctuary cities and states.

For those familiar with the president’s anti-immigrant musings, it was a familiar refrain. But this time, he was not content merely to engage in fearmongering. Mr. Trump was in the mood to punish those who would defy him.

On Wednesday, the administration announced that, for the time being, it would no longer allow residents of New York State to enroll (or re-enroll) in various Trusted Traveler Programs overseen by Customs and Border Protection, which allow preapproved individuals expedited passage through airport security and immigration.

In a letter to top officials at New York’s Department of Motor Vehicles, the acting secretary of homeland security, Chad Wolf, said the move was in response to a 2019 state law enabling undocumented immigrants to obtain driver’s licenses. Proponents of the so-called Green Light Law, which was hotly debated, argued for it on both humanitarian and public safety grounds, noting that similar laws adopted by other states had resulted in a reduction in hit-and-run accidents and an increase in the number of insured drivers. As a protective measure, the law also contains a provision that blocks federal immigration agents from retrieving information from the D.M.V.’s databases without a court order.

It does not bar federal officials from demanding identification, photos, passport data and interviews from applicants for Global Entry and other security programs for travelers.

This impediment to Mr. Trump’s deportation vision was too much for the administration to bear.

Barring access to these critical records, Mr. Wolf warned, undermines “ICE’s objective of protecting the people of New York from menacing threats to national security and public safety.” He said that New York’s lack of cooperation hinders federal agents’ ability to confirm whether an individual applying for Trusted Traveler Programs membership is eligible for its benefits. As a result, he concluded, his department had no choice but to “take immediate action.”

“Seek immediate political retribution” would have been the more honest phraseology.

Mr. Wolf’s security claims were met with skepticism, and some mockery, by the president’s critics.

“This is just irrational in the sense that sanctuary policies in no way, shape or form affect D.H.S.’s ability to vet people for Global Entry and other Trusted Traveler Programs,” John Sandweg, a head of ICE under the Obama administration, told CNN, warning that the move would “politicize the department in a way that’s going to undermine its mission moving forward.”

New York officials expressed outrage. Gov. Andrew Cuomo, an outspoken Trump antagonist, described it as “extortion.”

The administration’s decision will immediately affect an estimated 80,000 travelers whose applications were in process. By year’s end, as many as 200,000 people could be cut from the program as their memberships expire.