WASHINGTON — Staff members on Capitol Hill recall Stephen Miller, the 31-year-old White House adviser behind many of President Trump’s most contentious executive orders, as the guy from Jeff Sessions’s office who made their inboxes cry for mercy.

As a top aide to Mr. Sessions, the conservative Alabama senator, Mr. Miller dispatched dozens and dozens of bombastic emails to congressional staff members and reporters in early 2013 when the Senate was considering a big bipartisan immigration overhaul. Mr. Miller slammed the evils of “foreign labor” and pushed around nasty news articles on proponents of compromise, like Senator Marco Rubio of Florida.

One exhausted Senate staff member, forwarding a Miller-gram to a reporter at the time, wrote: “His latest. And it’s only 11:45 a.m.”

The ascent of Mr. Miller from far-right gadfly with little policy experience to the president’s senior policy adviser came as a shock to many of the staff members who knew him from his seven years in the Senate. A man whose emails were, until recently, considered spam by many of his Republican peers is now shaping the Trump administration’s core domestic policies with his economic nationalism and hard-line positions on immigration.

Video

President Trump’s 32-year-old senior adviser has gained attention for his hard-line stances in support of the president. Glenn Thrush takes a look at Mr. Miller, from his days as a young conservative to his current role in the White House.Published OnOct. 9, 2017CreditCreditDoug Mills/The New York Times

But his unlikely rise is emblematic of a White House where unconventional résumés rule — where the chief strategist is Stephen K. Bannon, until recently the head of the flame-throwing right-wing website Breitbart News, and the president himself is a former reality television star who before winning the nation’s highest office had never shown much interest in the arcana of governing.

Yet all three men are bound by a belief in an America-first economic policy that has suddenly moved from the fringes of American politics to the Oval Office.

“Stephen was the kind of guy who would make a passionate ideological argument to a roomful of people who were there to make pragmatic decisions,” said Alex Conant, a former aide to Mr. Rubio who remembers squaring off against Mr. Miller at a routine Republican messaging meeting that turned into a full-dress immigration debate.

Mr. Miller has been at the epicenter of some of the administration’s most provocative moves, from pushing hard for the construction of a wall along the border with Mexico to threatening decades-long trade deals at the heart of Republican economic orthodoxy, to rolling out Mr. Trump’s travel ban on seven largely Muslim nations, whose bungled introduction he oversaw.

Working in an administration that “didn’t come here to do small things,” as Mr. Bannon has put it, is a role that Mr. Miller — universally known as a tireless worker — has been preparing for much of his life. From his days at a public high school in Southern California, where he preached against “political correctness” and liberalism and called in to conservative radio shows, to his time at Duke University, where he was known for controversial writings in the student newspaper and a failed attempt at a run for dorm president, he has delighted in challenging prevailing orthodoxies.

At a freshman mixer, recalled a college classmate who spoke on the condition of anonymity, Mr. Miller announced, “My name is Stephen Miller, I am from Los Angeles, and I like guns.”

Mr. Miller, known for his skinny ties, so-outdated-they’re-chic pants and his recently abandoned chain-smoking habit, enjoyed a relatively turbulence-free ascent in Mr. Trump’s orbit until the travel ban. His eagerness to keep a tight lid on key details of executive orders to prevent leaks — as well as his inexperience — has at times hampered coordination between the West Wing and agencies that would have to carry them out, several White House officials said.

In part to deal with the confusion that surrounded the travel ban, Reince Priebus, the White House chief of staff, recently created a 10-point protocol that requires all major executive actions to be cleared with the communications department and other senior White House staff members before implementation.

But Mr. Miller’s peacock confidence has served him well with Mr. Trump, who first got to know him in 2015, when Mr. Miller helped bring Mr. Sessions, now the attorney general, into the Trump fold.

After the Republican National Convention in July, Mr. Miller became Mr. Trump’s principal day-to-day speechwriter once the candidate had switched from handwritten notes to a teleprompter in the middle of the campaign.

Image

President Trump congratulating Mr. Miller, center, after the senior adviser’s swearing-in last month.CreditAl Drago/The New York Times

The message in those speeches was so reflective of Mr. Trump’s views that it earned Mr. Miller a spot as the warm-up act for Mr. Trump’s campaign rallies. His words became Mr. Trump’s — “We’re going to build that wall, and we’re going to build it out of love,” Mr. Miller often said.

“Steve is a true believer in every sense of the word, not just in this message of economic populism but in President Trump as a leader,” said Jason Miller, who worked with him in the Trump campaign and is not related. “Steve’s fiercely loyal and has a better understanding of the president’s vision than almost anyone.”

It is sometimes hard to tell Mr. Trump’s voice from that of Mr. Miller, who suppressed his own orotund speech to capture the president’s more visceral, off-the-cuff style. Not that he has had much choice: As one of three or four staff members to fly around with Mr. Trump during the last few months of the campaign, Mr. Miller was summoned to speechwriting tasks by a bark of “Ready!” from Mr. Trump, who insisted on dictating practically every word — and laced into staff members who changed a word or inserted an overly complex policy point.

Mr. Miller’s flexibility as a speechwriter is offset by the consistent stridency of his political philosophy, which has remained much the same since he was the distinct minority at Santa Monica High School, a liberal outpost where he often railed against fellow students and the school administration. Mexican heritage celebrations and Iraq war protests were things of particular offense. He produced a 2003 essay, “How I Changed My Left Wing High School,” that capped a high school career steeped in political activism.

At Duke, Mr. Miller, who is Jewish, cut a similarly confrontational swath, and was briefly friendly with Richard Spencer, who later became a prominent white supremacist, when both were members of the university’s Young Conservatives chapter.

From there, it was straight to Capitol Hill, where Mr. Miller worked for Representatives Michele Bachmann of Minnesota and John Shadegg of Arizona before ending up with Mr. Sessions in 2009.

Mr. Sessions and Mr. Miller worked tirelessly against the 2013-14 congressional effort at an immigration overhaul. The bill passed the Senate easily in spite of Mr. Sessions’s vociferous objections, but failed in the House.

“We knew we were taking on the establishment, and Steve was an incredibly hard worker and had no second thoughts about it,” Mr. Sessions said in an interview.

Mr. Miller wrote many of the incendiary speeches that Mr. Sessions gave about the bill, including one in which he suggested that a Cuban-American aide to Senator Chuck Schumer, Democrat of New York, had been the author of a measure that he believed to be “amnesty” in disguise.

Ultimately, it was Mr. Miller’s dour views on illegal immigration that endeared him to Mr. Bannon and a small team of like-minded economic nationalists that included Julia Hahn, a former Breitbart writer. The group came together during the 2014 campaign of the far-right Republican candidate Dave Brat, whose upset win over the House majority leader, Eric Cantor, in a suburban Richmond, Va., district augured Mr. Trump’s success.

Even then, Mr. Miller had his eye on Mr. Trump, who had flirted with a run for president in 2012. Soon after Mr. Brat’s victory in the Republican primary in July 2014, Mr. Miller sent his friends a Breitbart interview in which Mr. Trump declared, “Everybody is vulnerable because what’s happening in the country is very sad, and the world is watching.” Mr. Miller added a comment: “Trump gets it. I wish he’d run for president.”

Mr. Bannon, Mr. Miller and the lesser-known head of the Domestic Policy Council, Andrew Bremberg, spent the later part of the transition period mapping out a shock-and-awe protocol of executive orders, sending more than 200 to federal agencies for review. The trouble came when they sent some of them to Obama-appointed officials at federal agencies for review, leading to leaks that prompted Mr. Miller to restrict the circulation of the plans.

Mr. Trump, initially pleased by the bold series of executive actions orchestrated by the team, was stung by the fallout from Mr. Miller’s execution of the immigration order, and expressed frustration about not being fully briefed on an order reorganizing the National Security Council to give Mr. Bannon additional power.

Despite the internal finger-pointing, Mr. Miller remains close to the still-powerful Mr. Bannon, who described him in an email as “a loyal and faithful soldier in the Trump movement, a warrior for the working class.”

In recent days, Mr. Miller has been working on what is expected to be another contentious order: an as-yet-uncirculated rewriting of the guest worker program that is likely to impose new restrictions on the cheap foreign labor that Mr. Miller deplored in many of his 2013 emails, according to two officials familiar with their planning.

Mr. Miller, one of the officials said, is working closely with Department of Homeland Security aides to avoid a repeat of the travel ban fiasco.

A version of this article appears in print on , on Page A20 of the New York edition with the headline: Once Seen as Mere Gadfly, ‘True Believer’ Now Shapes Key Trump Policies. Order Reprints | Today’s Paper | Subscribe