In this August 2015, photo, a woman approaches the entrance to the Mexico border crossing in San Ysidro, California.Lenny Ignelzi / AP

A few weeks ago, the contours of an immigration compromise looked clear: Republicans would let the “Dreamers” stay. Democrats would let Trump build his wall. Both sides would swallow something their bases found distasteful in order to get the thing their bases cared about most.

Since then, Trump has blown up the deal. He announced on Wednesday that he would legalize the “Dreamers,” undocumented immigrants brought to the U.S. as children, only if Democrats funded his wall and  ended the visa lottery and “chain migration.” He would support a path to citizenship for undocumented immigrants only if Congress brought the number of legal immigrants down.

There’s an irony here, which was pointed out to me by CATO Institute immigration analyst David Bier. Until recently, Republican politicians drew a bright line between illegal immigration, which they claimed to hate, and legal immigration, which they claimed to love. Florida Senator Marco Rubio launched his presidential campaign at the Freedom Tower, Miami’s Ellis Island. Texas Senator Ted Cruz, who in 2013 proposed a five-fold increase in the number of H1B visas for highly skilled immigrants, declared in April 2015 that, “There is no stronger advocate for legal immigration in the U.S. Senate than I am.” Mitt Romney promised in 2007 that, “We’re going to end illegal immigration to protect legal immigration.”

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.

Trump grasped that during the campaign, and in coalition with a bevy of current and former Southern Senators—Jeff Sessions, David Perdue and Tom Cotton—he has used it to turn the GOP into a party devoted to slashing legal immigration. On Thursday, when presented with a bill that traded the legalization of Dreamers for more border security but did not reduce legal immigration, only eight Republican Senators voted yes. However, 37 voted for a bill that legalized the “Dreamers,” added more border security, and substantially reduced legal immigration.

But there’s another reason Trump has succeeded in erasing the “legal good, illegal bad” distinction that for years governed GOP immigration debate. He’s made Republicans less concerned with legality in general. In 2012, the GOP—which was then-outraged by executive orders that supposedly displayed President Barack Obama’s contempt for the constitutional limits of his office—titled the immigration section of its platform, “The Rule of Law: Legal Immigration.” The seven paragraph-section used variations of the word “law” 14 times.

That emphasis is harder now. In his ongoing battles with the FBI, Justice Department, judiciary, and Special Counsel Robert Mueller, Trump has convinced many Republicans that the “rule of law” is often a cloak for the partisan biases of the “deep state.” As a result, Republicans are now 22 points less likely to hold a positive opinion of the FBI than they were in 2015.

What really matters for many Republicans in Trump’s standoff with Mueller and the FBI is not who has the law on their side, since the bureaucracy can twist the law to its own advantage. What really matters is who enjoys the backing of “the people,” the authentic America that resides outside the swamp, a construct that definitely does not include the imagined beneficiaries of “chain migration” and the “visa lottery.”

In the Trump era, Republicans now justify their immigration views less by reference to law than by reference to tribe. Which, not coincidentally, is how they justify Trump’s presidency itself.

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