Remember the “great replacement theory”? That was the name given to the widespread belief in MAGA circles that immigrants were being allowed to pour into the United States not because Democrats were inept at border control but because they were politically wily. The influx of migrants, the theory went, was a strategy to create millions of new Democratic voters and ensure permanent progressive dominance.

“A lot of these illegal immigrants coming in, they’re trying to get them to vote,” Donald Trump charged in his debate with Kamala Harris before the 2024 presidential election. JD Vance, putting it even more bluntly, told Tucker Carlson that Democrats believed they could not win elections “unless they bring in a large number of new voters to replace the voters that are already here.” When Tom Homan, the Trump administration “border czar,” was asked last spring about the rise in undocumented migrants, he claimed that the Biden administration engineered the influx because it believed “these millions of people were gonna be future Democratic voters.”

Whatever else might be said about the nativists’ theory, it was a testable hypothesis: More immigration boosts Democrats, so reducing immigration should help Republicans. Trump’s second term has put the theory to the test. After a year of the most aggressive immigration crackdown in modern American history — mass deportations, thousands of Immigration and Customs Enforcement agents deployed to cities nationwide, border apprehensions down 95 percent, and immigration halted from 93 countries — the test results are in.

Get The Gavel

A weekly SCOTUS explainer newsletter by columnist Kimberly Atkins Stohr.

Since the start of the year, the deployment of some 3,000 federal immigration and homeland security agents to Minneapolis resulted in the fatal shootings of two American citizens — a grim illustration of the human costs of the crackdown. But the political damage to Republicans began long before Minnesota erupted.

In the 2024 election, Hispanic voters flocked to the Republican Party, casting an unprecedented 48 percent of their ballots for Trump and enabling his historic return to the White House. Little more than a year later, many of those voters have turned against the Republicans. According to the Pew Research Center, “70 percent of Latinos disapprove of the way Trump is handling his job as president” — above all his handling of immigration, which 65 percent oppose and only 21 percent support. Young voters and independents — the other groups that shifted most dramatically to Trump in 2024 — are abandoning the GOP almost as quickly. When Trump recovered the presidency a year ago, there was much talk of a “vibe shift” that had made Trumpism popular and was realigning American politics. But now, as Nate Cohn wrote of the latest New York Times/Sienna College poll findings, “the vibe has shifted back.”

Republicans were routed in the latest elections in Florida, New Jersey, New York, and Virginia, and Hispanic backlash was a key factor. The blue wave wasn’t the result of a brilliant Democratic strategy to recover lost ground. It was the result of Republicans systematically alienating the very voters whose support made Trump’s victory possible in the first place. They imagined that choking off immigration would produce Republican gains. Instead, it’s produced a Republican collapse.

Last month, Unleash Prosperity — a pro-Trump, free-market advocacy group — issued a blunt warning: “Deportations are a Republican Disaster.” Its analysis was straightforward: “Without Hispanics shifting to Trump, Kamala Harris would be president today. So why are Republicans deporting them?” The MAGA clamor for even more mass deportations amounts to a call for “political suicide,” the committee said, and if the GOP doesn’t change course, “voters will rightly deport Republicans from office” in November.

In North Carolina, former Republican governor Pat McCrory worries that the crackdown is “having a negative impact on my party.” In New Jersey, the chair of Hudson County’s Republican Party fumes at the damage caused by a White House insistent on deporting people “who have been here 30 years [and] … have been good people for the United States.” In Minnesota, a Republican candidate withdrew from the governor’s race after the latest shooting by immigration agents, saying national Republicans have made it “nearly impossible” for a Republican to win statewide.

The evidence was always there. California Republicans were competitive statewide until they launched anti-immigrant campaigns in the 1990s, turning their state permanently blue. Texas Republicans took a softer line and maintained stronger Hispanic support. As Cato’s Alex Nowrasteh puts it, “whether immigrants vote for Republicans is mostly up to how Republicans treat them.” The great replacement theory had it backward: Hispanic voters don’t naturally favor Democrats, but treating them as invaders guarantees they will.

Trump, Vance, and the MAGA high command persuaded themselves that immigrant-bashing demagoguery was a long-term strategy for political gain. Now they’re learning what parties get when they treat fever dreams as wisdom: the exact political catastrophe they imagined, delivered not by their enemies but by their own delusions.

Jeff Jacoby can be reached at jeff.jacoby@globe.com. Follow him on X @jeff_jacoby.