The drunken-driving case seemed straightforward, the kind that prosecutors in Seattle convert into a quick guilty plea hundreds of times a year: a swerving car, a blood-alcohol level more than twice the legal limit, a first-time offense that caused no injuries.

The only complication was the driver. A 23-year-old undocumented immigrant studying at the University of Washington, she had gained some assurance against deportation through a federal program for people who had entered the country illegally as children. If she pleaded guilty to driving under the influence, the punishment any Washington resident might face could be compounded by a more permanent penalty. She could lose her protected status; she could be deported.

Which, for the prosecutor, presented a difficulty: Was this what justice should look like?

Now that President Trump’s hard line has made deportation a keener threat, a growing number of district attorneys are coming to the same reckoning, concluding that prosecutors should consider potential repercussions for immigrants before closing a plea deal. At the same time, cities and states are reshaping how the criminal justice system treats immigrants, hoping to hopscotch around any unintended immigration pitfalls.

These shifts may inaugurate yet another local-versus-federal conflict with the Trump administration, which is already tussling with many liberal cities over other protections for immigrants.