Had the occupations of Afghanistan and Iraq not gone so wrong, perhaps George W. Bush might have been able to contain the growing racism within his party’s rank and file by channeling it into his Middle East crusade, the way Ronald Reagan broke up the most militant nativist vigilantes in the 1980s by focusing their attention on Central America. For nearly two centuries, from Andrew Jackson forward, the country’s political leaders enjoyed the benefit of being able to throw its restless and angry citizens—of the kind who had begun mustering on the border in the year before 9/11—outward, into campaigns against Mexicans, Native Americans, Filipinos, and Nicaraguans, among other enemies.

But the occupations did go wrong. Bush and his neoconservative advisers had launched what has now become the most costly war in the nation’s history, on the heels of pushing through one of the largest tax cuts in the nation’s history. They were following the precedent set by Reagan, who in the 1980s slashed taxes even as he increased the military budget until deficits went sky-high. Yet the news coming in from Iraq, Afghanistan, and elsewhere began to suggest that Bush had created an epic disaster. Politicians and policy intellectuals began to debate what is and isn’t torture and to insist that, whatever “enhanced interrogation” was, the United States had a right to do it. Photographs from Abu Ghraib prison showing US personnel cheerfully taunting and torturing Iraqis circulated widely, followed by reports of other forms of cruelty inflicted on prisoners by US troops. Many people were coming to realize that the war was not just illegal in its conception but deceptive in its justification, immoral in its execution, and corrupt in its administration.

Every president from Reagan onward has raised the ethical stakes, insisting that what they called “internationalism”—be it murderous wars in impoverished Third World countries or corporate trade treaties—was a moral necessity. But the disillusionment generated by Bush’s war on terrorism, the velocity with which events revealed the whole operation to be a sham, was extraordinary—as was the dissonance. The war, especially that portion of it allegedly intended to bring democracy to Iraq, was said to mark a new era of national purpose. And yet a coordinated campaign of deceit, carried out with the complicity of reporters working for the country’s most respected news sources, had to be waged to ensure public support. The toppling of Saddam Hussein was predicted to be a “cakewalk,” and US soldiers, according to Vice President Dick Cheney, would “be greeted as liberators.” But Cheney still insisted that he needed to put in place a global network of secret torture sites in order to win the War on Terror.

As thousands died and billions went missing, the vanities behind not just the war but the entire post–Cold War expansionist project came to a crashing end. And as the frontier closed, some turned back to the border. Sporadic violence gave way to organized paramilitary extremism.

War revanchism usually takes place after conflicts end—the Ku Klux Klan after World War I, for example, or the radicalization of white supremacism after Vietnam. Now, though, it took shape while the war was still going on. And border paramilitarism began to pull in not only soldiers who had returned from the war but the veterans of older conflicts. The Minuteman Project, which began patrolling the desert looking for undocumented migrants shortly after the Abu Ghraib story broke, was founded by a Vietnam vet. The project grew rapidly over the next three years, even as it splintered into different groups, with vigilante franchises starting to harass day laborers gathered on city street corners far from the border, in places like Long Island’s East End, or targeting Latino families in Kansas City parks. By the end of 2006, according to one count, 140 Minuteman branches had been established in 34 states, claiming 12,000 members.

As Bush lost control of his occupations, he lost control of his party. Having gotten their tax cuts and their war, Republicans were struggling with the fallout from both. Many at the time thought that modern conservatism was on the wane, done in by its own ideological excess, a contradictory commitment to a militarized national-security state and libertarian economics, to its fetishizing of individual freedom and its stoking of the culture war, including racial grievances.

Bush won reelection in 2004, but the lesson that many party leaders took from the victory—as they looked at the changing demographics of states like Arizona, Texas, and Florida—was that Republicans, to stay viable on a national level, would have to win over Latino voters. To that end, the Bush White House hoped to replicate Reagan’s immigration gambit. It put forth legislation that would further militarize the border but also allow, for those undocumented residents who qualified, a one-time path to citizenship.

But the proposed reform electrified vigilantes, who mobilized successfully to kill the legislation. This mobilization, in turn, revived the flagging conservative movement. A blast of nativist fanaticism helped to stay an unraveling caused by the movement’s already existing fanaticism, providing new coherence, vitality, and a way forward that didn’t include citizenship for millions of undocumented residents.

In the last months of the Bush presidency, with the grassroots rage that had assembled on the border spreading through the nation, and with the country bogged down in Afghanistan and Iraq, the housing and credit markets began to collapse. Banks failed. Mortgage foreclosures and evictions spiked. Inequality and personal debt deepened as social services were stretched thin. And still, no matter how many patrollers the government put at the border, no matter how many deportations Bush carried out, Mexicans and Central Americans kept arriving.

And then the country elected a black man to the presidency. Under Bush, the various border-vigilante groups expanded nationally and helped set federal policy. Under Barack Obama, they merged with other right-wing organizations into what became known as the Tea Party. Cross-fertilization occurred at every level, as anti-immigrant Republicans rebranded themselves as libertarians and anti-Latino organizations mobilized around fiscal “responsibility.” In places like Cochise County, Arizona, long a preserve of right-wing rancher vigilantism, the Minutemen and the Tea Party merged. “Build a wall and start shooting,” said one featured speaker at a 2010 rally in Phoenix. “Line ‘em up. I’ll torture them myself.” Cruelty, by this point, was a way of establishing symbolic dominance over foreigners. But it was also a badge of contempt for the political establishment and all its leaders and institutions.

Obama’s election “packed an emotional wallop,” as the historian Daniel Rodgers put it, but his administration produced “only a policy whimper,” seeking to address the multiple calamities inherited from his predecessor not with radical solutions but on familiar terms. Even if the Republican Party had agreed to implement in full the agenda Obama laid out in any one of his eight State of the Union addresses, it would only have marginally improved the precarious conditions for the many millions who lived in poverty. Obama kept reaching for a center that no longer existed, a center that he seemed to think he would be able to reconstitute by the power of his rhetoric and the infiniteness of his patience. In the meantime, the nativist right continued to coalesce.

The wars went on, and the military, with its outsized budget, still served as the country’s most effective instrument of social mobility and provider of health care and education. But whereas Bush had framed militarism as an ideological struggle, Obama presented it as a matter of utility and competence. As he did so, the country lost its ability to channel extremism outward, and the kind of chaos the United States had released in the Persian Gulf was increasingly mirrored at home, in an escalating spiral of mass school shootings and white-supremacist and masculinist rampages.

With the country unable to imagine a future moving outward, fights over the people trying to move inward grew even more intense. Here, too, Obama tried to meet his opponents halfway. He signed an executive order, known as Deferred Action for Childhood Arrivals (DACA), which provided protection to some undocumented residents who had entered the country as minors. But he also increased the funding and staffing of the nation’s various border, customs, and immigration agencies.

The Obama White House made the same mistake that Bush’s did, getting caught in the same “enforcement-first” trap that insists the border has to be “sealed”—an impossible proposition—before reforms can be passed. Obama hoped that stepping up border security would open a space for compromise. But the situation got away from him. A surge of Central American children—tens of thousands every year between 2009 and 2014—began arriving at the border, mostly from El Salvador, Honduras, and Guatemala. In response, the White House diverted more resources to try to secure the border and stepped up deportations. By 2012, the United States was spending more on immigration enforcement than on all other federal criminal-law-enforcement agencies combined.

Still, as it had under Bush, immigration reform failed, even as the impunity of Immigration and Customs Enforcement (ICE) and the Border Patrol—along with the budget for border militarization—grew. As Obama reached the end of his second term, right-wing grievances continued to spin in a circle: from migrants to health care; from taxes, war, and guns to Confederate flags, ISIS, Mexican cartels, and environmental regulations; from sharia law, energy policy, and gender pronouns to Central American gangs and Black Lives Matter—and finally back to migrants, to DACA recipients and Central American children.

The backlashes to decades of disastrous policies piled up, one after the other, until the backlash of all backlashes came: Donald Trump. The nativism that had rallied at the border under George W. Bush, and that for eight years was expressed in an almost psychotropic hatred of Barack Obama, crystallized into what some have described as “race realism”: a rejection of the legitimizing premises of the liberal multilateral order—especially the idea that all could sit at the table and enjoy the world’s abundance, that the global economy should be organized around lines as open as possible, and that diversity rather than, say, Anglo-Saxonism could serve as the foundation of political communities.

In the past, politicians—even during moments of acute crisis—could look beyond the settlement line and point to the possibilities. Now, one politician in particular said there was nothing out there but peril.

As a worldview, race realism is often expressed as instinct rather than a worked-out philosophy and has taken many forms in the United States, including a reflexive sympathy for law-enforcement agencies and racial resentment. But over the past few decades, the border has provided increasing coherence to the sentiment. In July 2014, for instance, residents of Murrieta, California, just north of San Diego, took to the streets for days, waving US and Gadsden flags and hurling racist slurs, trying to stop buses carrying Central American families to a nearby federal facility. “We can’t start taking care of others if we can’t take care of our own,” one protester said, offering a concise précis of what would soon be called “Trumpism.”

The buses were turned back—the families shunted to some other federal detention center—and two years later, Murrieta residents, by a large margin, voted for Donald Trump.