WASHINGTON — When a federal judge in California ordered a stop last week to a key plank of President Trump’s immigration agenda, he revived a debate that has simmered in this age of partisanship: the role of the impartial judiciary in American democracy.

The judge, William Alsup of the Northern District of California in San Francisco, used a local case to impose a nationwide stop on Mr. Trump’s order to end a program that protects young undocumented immigrants in the United States.

The tactic has gained popularity among federal judges as a tool to combat perceived executive overreach. But legal scholars say it is helping to erode the idea of an impartial judiciary, and Judge Alsup’s decision opened him to critiques that he overstepped his boundaries by applying national orders in a regional case.

The possibility of obtaining a comprehensive injunction that impedes, or even thwarts, the opposition has legal scholars worried that more plaintiffs’ lawyers will take cases to sympathetic judges.