Andrew Harnik / AP

With less than a week to go before the midterm elections, President Donald Trump is warning darkly of an imminent immigrant “invasion,” deploying thousands of troops to the U.S.-Mexico border, releasing a racist ad on Twitter, and threatening to issue an executive order aimed at ending birthright citizenship.

The president has, in pundit-speak, found his “closing argument” for the 2018 campaign season.

Indeed, many savvy observers in recent weeks have interpreted Trump’s efforts to inflame national tensions around immigration as a desperate, last-ditch ploy to save his party’s at-risk congressional majorities. But while the president himself may be acting on some mix of impulse and improv, the roots of the strategy go deeper—and its architects in the West Wing are looking far beyond the current election cycle.

To understand the thinking behind Trump’s gambit, it is necessary to spend a few minutes inside the head of Stephen Miller, the 33-year-old speechwriter and senior policy adviser to the president. A fierce immigration hawk who’s championed a right-wing nationalist agenda, Miller is Trump’s most trusted adviser on immigration, and he is constantly looking for new ways to push his policy priorities into the national spotlight. Earlier this year, it was reported that Miller was leading an effort within the administration to crack down on immigrants in the run-up to the midterms. And as Politico reported Wednesday, Trump’s latest string of provocations—from the immigrant-caravan scaremongering to the likely unconstitutional executive order—represents a “dream come true” for Miller.

In recent months, Miller has remained firmly planted behind the scenes, having perhaps realized that his glowering supervillain persona doesn’t make him the most effective spokesman. But when I interviewed him at length in his West Wing office last March, he was all too happy to extol the political advantages of his boss’s strident immigration platform.

Americans “were quote-unquote warned by Hillary Clinton that if they elected Donald Trump, he would enforce an extremely tough immigration policy, crack down on illegal immigration, deport people who were here illegally, improve our vetting and screening, and all these other things,” Miller told me. “And many people replied to that by voting for Donald Trump.”

According to Miller, Trump benefits politically any time Americans are focused on immigration—no matter how bad the headlines, no matter how bleak the polls, no matter how big the controversy. “You have one party that’s in favor of open borders, and you have one party that wants to secure the border,” he told The New York Times earlier this year. “And all day long the American people are going to side with the party that wants to secure the border. And not by a little bit. Not 55–45. 60–40. 70–30. 80–20. I’m talking 90–10 on that.”

Even setting aside the hyperbole, this view of the electorate is debatable. (Voters seem to have given Trump mixed reviews on his handling of the caravan, for example.) But it’s still worth understanding how Miller lays out his political calculus. While he may be a committed ideologue, he works for and with a lot of Republicans who are guided more by opportunism than by ironclad conviction when it comes to immigration. The long-term relevance of his sharply nativist politics within the GOP will depend in part on the Miller faction’s ability to keep selling it as a winning strategy (even in the face of evidence to the contrary).

Back when we spoke in March, Miller’s approach was to couch his restrictionist immigration views in a grander, gauzier vision of American nationalism—an idea he believes is destined to win out in the 21st century.

“The future of the Republican Party should be tapping into … the feeling of belonging and meaning and pride that comes with being part of this whole ‘America First’ movement,” he told me. “There’s something really beautiful about people from all different walks of life … who are bound together by this big idea about American identity, and American unity, and American interests.”

Continuing in concern-troll mode, Miller said, “I think one of the big challenges facing modern liberalism is that there’s not a great emotional appeal to an international identity, like a citizen-of-the-world identity.”

I prodded him to expound.

“Look, the current nation-state model is the product of thousands of years of political, social, and cultural evolution,” Miller said. “I mean, it was only recently, in like the last few decades, that people have tried to create an organizing principle larger than the nation-state.” The desire to root for your own native country is “intrinsic” to human nature, he told me. “You see that flag, you sing the national anthem, or you hear your team wins the gold medal … it creates a kind of pride in you that is really hard to translate.”

One of Trump’s most “brilliant” moves during the campaign, Miller said, was doubling down on his America First slogan despite strong objections from Democrats. When I noted that many of those early objections had to do with the slogan’s historically anti-Semitic roots—which go back to World War II—Miller waved away the argument as “completely insincere.” What they really disliked, he insisted, was Trump’s national populism.

In an attempt to prove his point, he extended a challenge: “Find today your most liberal friend, and ask them this question: Who has more of a right to a job in America—a U.S. citizen, or an illegal immigrant? And if they don’t say U.S. citizen like that”—Miller snapped his fingers—“then that means on some philosophical level they find the idea of America First objectionable.”

Miller made a point of distinguishing the worldview he’d been describing from the “white nationalism” he’s often accused of espousing. “It doesn’t matter where that citizen comes from, where their family comes from,” he insisted (a claim undermined by Trump’s support for ending birthright citizenship). “But the idea of having official membership in the nation-state, and therefore that state has an obligation to protect you”—that was the big idea he believed voters would keep coming back for. Voters feel that connection at a visceral level, Miller suggested, and in the end they would always side with a president offering that appeal.

Americans will find out next week if Trump’s cynical bet on caravan conspiracy theories will pay off at the polls. But regardless of what happens on Election Day, Miller and his nativist allies in the GOP aren’t about to let up. For them, this isn’t a “closing argument”—it’s just the beginning.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.