In the last two weeks, Mr. Trump has followed an instinct, one nurtured by Mr. Miller, that a foreboding message on immigration can galvanize his supporters.

The president has sought to sow fear of immigrants by focusing on a caravan of people fleeing violence and poverty in their Central American countries, deploying active-duty members of the military to the border with Mexico and extolling the beauty of barbed wire as a deterrent. Mr. Trump has also resurrected one of his hardest-edge campaign proposals, calling for an end to “birthright citizenship.”

It is an agenda Mr. Miller has pushed tirelessly inside the West Wing, where he has consolidated his power around the issue, even as several other aides have split into factions or left the administration. In Mr. Trump’s world, no one has merged policy details and politics more forcefully than Mr. Miller.

Mr. Miller, 33, has become known in that orbit for amassing frightening news articles and isolated statistics about immigration that he is aware might fuel a presidential declaration on Twitter. He has helped install a group of like-minded aides across the government, including at the Department of Homeland Security, the State Department and the Justice Department, who have helped him pursue his agenda.

The result is that Mr. Trump and Mr. Miller have thrust immigration — long an issue that conservatives felt was ignored by establishment Republicans — into the spotlight again and again.