Trump has turned that distinction on its head. He’s willing to legalize the “Dreamers”—who came to the United States illegally—so long as the number of legal immigrants goes down. He has not only blurred the GOP’s long-held moral distinction between legal and illegal immigration. In some ways, he’s actually flipped it—taking a harder line on people who enter the U.S. with documentation than those who don’t.

What explains this? Trump’s great hidden advantage during the 2016 Republican presidential primary was his lack of support from the GOP political and donor class. This allowed him to jettison positions—in support of free trade, in support of the Iraq War, in support of cutting Medicare and Social Security—that enjoyed support among Republican elites but little support among Republican voters. He did the same on immigration, where the “legal good, illegal bad” distinction turned out to be much more popular among the party’s leaders than among its grassroots. Cribbing from Ann Coulter’s book, Adios America, Trump replaced the legal-illegal distinction with one that turned out to have more resonance on the activist right: The distinction between white Christian immigrants and non-white, and non-Christian ones.

The words “illegal immigration” do not appear in Trump’s presidential announcement speech. Instead, Trump focused on immigrants’ country of origin. “When Mexico sends its people,” he declared, “they’re not sending their best … They’re sending people that have lots of problems, and they’re bringing those problems with us. They’re bringing drugs. They’re bringing crime. They’re rapists … It’s coming from more than Mexico. It’s coming from all over South and Latin America, and it’s coming probably—probably—from the Middle East.”

Trump, who often says bluntly what other Republicans say in code, probably realized that “illegal immigrant” was, for many voters, already a euphemism for Latino or Mexican-immigrants. In their book White Backlash, the political scientists Marisa Abrajano and Zoltan Hajnal cite a poll showing that 61 percent of Americans believe that most Latino immigrants are undocumented even though only about a quarter are. “When Americans talk about undocumented immigrants, Latinos or immigrants in general,” they note, “the images in their heads are likely to be the same.”

What really drove Republican opinion about immigration, Trump realized, was not primarily the fear that the United States was becoming a country of law-breakers. (Republicans, after all, were not outraged about the lack of prosecution of tax cheats.) It was the fear that the United States—which was becoming less white and had just elected a president of Kenyan descent—was becoming a third-world country.

When the Public Religion Research Institute and Brookings Institution asked Americans in 2016 their views of immigration from different parts of the world, it found that Republicans were only three points more likely than Democrats to want to reduce immigration from “predominantly Christian countries” and only seven points more likely to want to reduce immigration from Europe. By contrast, they were 33 points more likely to support reducing immigration from Mexico and Central America and 41 points more likely to support reducing immigration from “predominantly Muslim countries.” What really drives Republican views about immigrants, in other words, is less their legal status than their nation of origin, their religion, and their race.