Next week, Donald Trump will join Ted Cruz, Glenn Beck, and others at a rally denouncing the Iran deal. Which is ironic, because Trump is one reason the deal will pass.

Before Trump entered the campaign, foreign policy dominated the Republican presidential race. With Democrats less vulnerable on the economy, and the public growing more progressive on cultural issues like gay marriage, drugs, and crime, the GOP candidates refocused on America’s supposedly collapsing position in the world. As The New York Times reported in February, “Gruesome killings by the Islamic State, terrorist attacks in Europe and tensions with President Vladimir V. Putin of Russia are reshaping the early Republican presidential race, creating anxiety among party voters and sending potential candidates scrambling to outmuscle one another on foreign policy.”

At the core of that foreign-policy focus was Iran, and the threat it posed to America and Israel. When Lindsey Graham announced his presidential run, he said “the nuclear ambitions of the radical Islamists who control Iran” constitute the “biggest threat” to the United States. Between them, Graham, Marco Rubio, Ted Cruz, Scott Walker, Mike Huckabee, and Rick Santorum mentioned Iran or Israel 26 times in their announcement speeches. They mentioned China twice and Mexico not at all.

In focusing on Iran and Israel, Republican candidates were articulating an outward-looking nationalism. Their basic argument, which they applied to Russia and ISIS too, was that because President Obama didn’t really believe in America, he had overseen America’s retreat from the world. As a result, America’s enemies were stronger, America’s allies were fearful, and the world had become a more chaotic, more dangerous place. The answer, GOP candidates declared, virtually in unison, was to reassert American power. By bolstering America’s sagging empire, they would make America safer and the world more stable and free.

Then along came Trump. In his announcement speech, he mentioned Israel twice, Iran seven times, Mexico 13 times and China 24 times. Trump didn’t contradict the narrative being spun by his rivals; he made his contempt for the Iran deal plain. But his focus was different. Instead of outward-looking nationalism, Trump peddled inward-looking nationalism. He, too, said that America under Obama was weak. But instead of focusing on the consequences of that weakness overseas, he focused on the consequences at home. Instead of focusing on how Iran was making the Middle East dangerous and chaotic, he focused on how illegal immigrants from Mexico were making the United States dangerous and chaotic. Instead of focusing on how Russia was undermining Ukraine, he focused on how China was stealing American jobs. The other candidates said hostile countries were undermining America’s global position. Trump focused on the way said hostile countries were undermining Americans’ quality of life.

In so doing, Trump exploited a cleavage between the Republican elite and many Republican voters. For the most part, GOP elites are nationalists when it comes to international politics but globalists when it comes to international economics. They favor a tough line on countries like Iran and Russia that pose military threats but a soft line on countries like China and Mexico that pose economic threats. That’s because those economic threats don’t apply to them. Trade with China and illegal immigration from Mexico don’t threaten their livelihoods; they enhance them.

Many ordinary GOP voters, by contrast, are nationalists on both international politics and economics. And they toggle back and forth between those priorities, depending on what’s going on in their lives and what’s in the news. In the 1980s, conservatives mostly focused on the political threat posed by the USSR. But when the Cold War ended, many drifted to Ross Perot and Pat Buchanan, who emphasized the economic threat posed by NAFTA. Similarly, last year’s ISIS beheadings turned many conservatives’ attention to the Middle East. They sparked both fear and an intense desire to defend America, and Christianity, by wiping ISIS out. Iran, because of its history of humiliating the United States, sponsoring terrorism, and threatening Israel, became part of the same nationalist cocktail.

But today, ISIS beheadings no longer dominate cable news. Donald Trump does. Since June, Trump has received as much news coverage as the rest of the GOP field combined. Entrepreneur that he is, Trump saw that economic nationalism represented a big market on the grassroots right. He saw that because of their fealty to large donors, the other candidates weren’t serving it. And so he did. With his huge megaphone, he made illegal immigration and trade with China central to the Republican campaign. “If it weren’t for me, you wouldn’t even be talking about illegal immigration,” Trump told Chris Wallace at the first Republican debate. “This wasn’t a subject that was on anybody’s mind until I brought it up at my announcement.”

That’s hyperbole. But because of Trump, Republican candidates are talking a lot more about border walls and birthright citizenship than they were earlier in the year. They’re also talking more about China. And this new focus has come at the Iran deal’s expense. Grassroots Republicans still oppose the Iran deal. But they’re not thinking about it nearly as much. Craig Robinson, former head of the Iowa GOP, told me that in the Hawkeye State, Trump has “refocused the summer on what he wanted to talk about.” When I asked Dean Spiliotes, a political scientist at Southern New Hampshire University, about the conversation in his state, he said that, “Among Republicans there’s a lot more energy around immigration and trade and jobs than around Iran.”

I don’t want to overstate the case. The Iran deal would probably be on its way to passage even without Trump. Obama doesn’t need Republican votes. He needs Democratic ones, and most Democrats were not inclined to torpedo the signature foreign-policy initiative of a president of their own party. But to have had any chance, the anti-deal campaign needed to make Iran the dominant issue of the August recess. It needed to replicate the intensity that anti-Obamacare activists generated during the August recess of 2009.

For all the money they’ve spent on ads denouncing the deal, that hasn’t happened. Iran may be issue number one among Republican elites. But it’s not issue number one among the Republican grassroots, let alone Americans as a whole. And Trump is part of the reason why.