We now have scientific evidence that it takes Republican politicians 22 years to forget the lessons of anti-immigrant politics. Poised to repeat history, the GOP and Donald Trump have decided to shoot the party’s long-term fortunes in the foot by catering to calls for a deportation war against the country’s 11 million undocumented immigrants. It is an echo of a similar move that California Republicans made more than two decades ago, one that sent the party into the political wilderness for a span that rivals that of Moses’s journey through the desert. Here is how it came about the last time and what it says about GOP politics this time around.

When I was a young legislative assistant and public-interest advocate in the California State Capitol in the 1980s and 1990s, it seemed like we would never escape the reign of Republican governors. In the aftermath of eight years of wild and youthful leadership under the 30-something version of Jerry Brown, we were given Governor George Deukmejian. The state attorney general rode to the governorship as a champion of the death penalty and never thought a sentence complete unless it included the word “crime.” When his eight years were up, we got San Diego Mayor Pete Wilson, a supposed GOP moderate. History, however, will remember Wilson as the inventor of the “Great Republican Anti-Immigrant Boomerang.”

Today Donald Trump yells out his plan to build a wall across the United States’ southern border. It was, ironically, the fall of a different wall that helped set the Republican Party’s extreme anti-immigrant politics in motion. Two and a half decades ago, in the space of just a few years, the Berlin Wall fell, the Soviet empire disintegrated, and the long Cold War finally thawed. One byproduct of that turn of history was a major cutback in the lucrative defense and aerospace contracts—the tech industry of the day—that had helped make the Golden State golden.

These cuts came in the midst of a national recession, and nearly a million high-wage jobs evaporated with the cutback, taking the state’s economy and tax revenue along with it. Unemployment boomed, and spending on things like schools and libraries took a huge hit. Wilson may not have caused the crisis, but as he looked ahead, he saw it careening directly into his reelection against Brown’s younger sister, Kathleen, at the time the state treasurer. He pulled out the default Republican pledges of cutting taxes and cutting waste from the budget, but this alone wasn’t working.

On the right-wing fringes of the party, however, there were others who knew exactly what was needed to fix California—bring the hammer down on undocumented immigrants. While it was no small stretch to blame immigrant day-laborers for the loss of engineering jobs or the massive hole in the state budget, the anti-immigrant movement did so and peddled the tale hard.

Wilson and Republicans in the legislature dipped their toes into the anti-immigrant waters cautiously, with modest proposals for reforms such as requiring public hospitals to count the number of undocumented people receiving services. Beyond the capitol though, fringe activists had something far more drastic in mind. They were circulating petitions to put an initiative on the November 1994 ballot, the so-called “Save Our State” initiative (which later became Proposition 187). The initiative, launched by groups that peppered their newsletters with racist blather such as “wake up and smell the refried beans,” had two main provisions, both wildly more extreme than anything the Republicans in Sacramento had floated: a flat ban on undocumented immigrants receiving public health care, and kicking undocumented children out of California classrooms.

But the extremist measure was going nowhere. My organization took on the role of tracking the initiative’s progress for the immigrant-rights movement, and the campaign showed all the signs of being a half-baked effort destined to become no more than a political footnote. With six weeks left before the petitioning deadline, the measure’s backers had collected less than a quarter of the signatures they needed and had about $11,000 in the bank. Then suddenly, a panicked Governor Wilson and GOP swooped in to save the day.

Having concluded that they could not win a campaign about jobs and public services, they tried instead to change the subject to an “invasion of illegal immigrants.” Adopting the extremist initiative and putting it on the ballot was the strategy for doing that. The party rolled out a mass fundraising mailing and then fielded a last-minute army of paid signature gatherers to finish the task of qualification. Wilson not only endorsed the measure, he made it the core of his reelection effort. The Los Angeles Times reporter covering the campaign, Patrick McDonnell, told me in an interview afterwards, “It became almost hard to distinguish the ‘YES on 187’ campaign from the Pete Wilson campaign.”

The Republicans’ strategy worked beyond their wildest dreams. Governor Wilson won reelection by a 14 percent margin, on the heels of a landslide victory for Proposition 187 by an 18 percent margin. The day after the vote, some of the children in my daughter’s second-grade class in San Francisco didn’t show up because their parents were afraid to send them. Immigrant families were terrified.

And then the boomerang swung back around. The first blow was struck against the law itself when a federal court blocked it as unconstitutional the month after it was approved. The next returning blow came aimed at the Republican Party, and it came fierce.

In 1984 President Reagan won 45 percent of the California Latino vote in his race for reelection and carried the state. Winning reasonable shares of the Latino vote had helped Republicans carry the state in presidential elections throughout the 1970s and ’80s. It helped the party elect senators and governors and to capture other statewide offices with regularity. Today in California not a single statewide office is held today by a Republican—not governor, not senator, not state controller or any of the others; none. Republicans have not won or even seriously contested the state’s presidential vote since 1988. The only major statewide victories for the GOP in California since Proposition 187 were the election and reelection of Arnold Schwarzenegger, which had to do a lot more to do with him being the Terminator than being a Republican.

What happened? The Republican Party declared political war against the fastest-growing voting bloc in the state and Latinos declared war back. The Latino vote for the Democratic nominees for governor, for example, has grown steadily and steeply since the days of Proposition 187. In 2006, it was 56 percent, in 2010 it was 64 percent, and in the last round in 2014 it was 73 percent. The same holds true up and down the state ballot. With its war on the undocumented, the Republicans sparked a Latino exodus from its candidates akin to what it did with black voters in the 1960s with the party’s opposition to civil rights.

Today Donald Trump, with his call for a wall, his pledge of 11 million deportations, and his racist rhetoric about Mexican “rapists” appears as a human reincarnation of Proposition 187. His strategy has been, once again, one that has worked brilliantly in the short-term, enabling the reality-television show host to become the GOP nominee. But just as Governor Wilson won a short-term victory two decades ago at the price of long-term political damage to the party, the boomerang of anti-immigrant politics looks to be headed right back at the GOP once again, the only difference being that, this time, the effect will be national. Smarter Republicans saw this coming, but as Jeb Bush showed in the primaries, those who don’t toe an anti-immigrant line suffer deeply at the hands of the party’s political base.

The Latino vote for the Democrats this November will surely break all national records, and it is likely to be a very long time before any future GOP presidential candidate starts to win it back. To be clear, Democrats shouldn’t take their expanding Latino surge for granted. That vote must be interpreted as a demand for real action. But, when it comes to immigration, never underestimate the ability of Republicans to shoot themselves in the foot by playing to the rabid politics of the moment. As the expression in Spanish goes, “Están comiendo su almuerzo y la cena para el desayuno”—they are eating their lunch and their dinner for breakfast. Bon appétit.