WHEN THE Obama administration established a program in 2014 for “dreamers” — young undocumented immigrants brought to the United States as children by their parents — the deal was simple: They would register with the Department of Homeland Security and submit to a background check. If their records were clean and they met certain criteria, they would receive work permits and be shielded from deportation on a two-year, renewable basis.

Since then, some 750,000 people have registered for the program, known as Deferred Action for Childhood Arrivals (DACA), and most are studying or working in this country, leading peaceable and productive lives. Yet along with feeling relief and gratitude for having been offered a reprieve, and a way out of the shadows, many feel nervous — and for good reason. Will President-elect Donald Trump, who has threatened to deport all illegal immigrants, use information they willingly gave the federal government, including addresses, to track them down and deport them?

That, says Sen. Lindsey Graham (R-S.C.), would be “the worst outcome.” He’s right. What possible advantage would be gained by targeting and tracking down this group of immigrants, who grew up in the United States, attended American high schools, live thoroughly American lives and in many cases have no memory of any other country?

Mr. Graham, along with fellow Republican Sen. Jeff Flake (Ariz.) and a number of Democrats, is working on legislation that would protect dreamers by extending the legal protections they were granted by DACA. It would spare them from adverse consequences for having done nothing more than voluntarily sign up for protections offered by a federal program initiated by President Obama.

Immigration hard-liners will regard Mr. Graham’s bill as amnesty; it is nothing of the sort. He is proposing neither citizenship nor indefinite legal status for dreamers; rather, he would simply allow them to continue leading the lives they have made for themselves in this country, to which they were brought through no fault of their own.

What Mr. Trump does about the dreamers will be an early test of his administration’s capacity for cruelty — or for compassion. His most recent stance suggests he would prioritize for deportation undocumented immigrants who are criminals, a stance that dovetails with Mr. Obama’s own. To go further, or to engage in deportation sweeps that target dreamers and others whom the president-elect has referred to as “terrific” people, would be an act of gratuitous malice.

Mr. Trump has promised to repeal Mr. Obama’s executive actions on immigration, including the one from which dreamers have benefited. He is empowered to do so. Similarly, Congress is entitled to pass legislation that would lift the threat of deportation from a cohort of young, promising and energetic immgirants who will be a benefit to this country and its economic prospects for decades to come.