You know how, after you watch a movie with a surprise ending, you sometimes replay the plot in your head to find the clues you missed the first time around? That’s what I’ve been doing lately with the history of conservatism — a movement I had been part of since my teenage days as a conservative columnist at the University of California at Berkeley in the early 1990s. In the decades since, I have written for numerous conservative publications and served as a foreign policy adviser to three Republican presidential candidates. It would be nice to think that Donald Trump is an anomaly who came out of nowhere to take over an otherwise sane and sober movement. But it just isn’t so.

Upon closer examination, it’s obvious that the history of modern conservative is permeated with racism, extremism, conspiracy-mongering, isolationism and know-nothingism. I disagree with progressives who argue that these disfigurations define the totality of conservatism; conservatives have also espoused high-minded principles that I still believe in, and the bigotry on the right appeared to be ameliorating in recent decades. But there has always been a dark underside to conservatism that I chose for most of my life to ignore. It’s amazing how little you can see when your eyes are closed!

The ur-conservatives of the 1950s — William F. Buckley Jr., Barry Goldwater, Ronald Reagan and all the rest — were revolting not against a liberal administration but against the moderate conservatism of Dwight D. Eisenhower. Ideological conservatives viewed Eisenhower as a sellout; John Birchers thought he was a communist agent. Why the animus against this war hero? Conservatives were furious that Eisenhower made no attempt to liberate the “captive nations” of Eastern Europe or repeal the New Deal, and that he did not support Joseph McCarthy’s Red Scare. Worst of all, from the viewpoint of contemporary conservatives, Eisenhower was a moderate on racial issues. He appointed Chief Justice Earl Warren, who presided over the Supreme Court’s school desegregation decision, Brown v. Board of Education, and then sent troops to Little Rock to enforce desegregation.

Most Republicans in Congress voted in 1964 and 1965 for landmark civil rights legislation, but not Goldwater. In his 1960 bestseller “The Conscience of a Conservative,” Goldwater wrote that “the federal Constitution does not require the states to maintain racially mixed schools.” Goldwater was not personally a racist — he had integrated the Arizona Air National Guard — but, like his GOP successors, he was happy to make common cause with racists in order to wrest the South from the Democrats.

Goldwater was just as extreme when it came to foreign affairs. He suggested that Americans needed to overcome their “craven fear of death.” If the Soviets intervened to crush another uprising in Eastern Europe, like the one in Hungary in 1956, he wanted “to move a highly mobile task force equipped with appropriate nuclear weapons to the scene of the revolt.” I used to think Goldwater’s reputation as an extremist was a liberal libel. Reading his actual words — something I had not done before — reveals that he really was an extremist.

The delegates to the 1964 Republican National Convention who chose Goldwater as their presidential nominee fully endorsed his far-right views. They lustily applauded Goldwater’s assertion that “extremism in the defense of liberty is no vice” and that “moderation in the pursuit of justice is no virtue,” while booing and jeering Nelson Rockefeller when he tried to deliver a more moderate message. Goldwater didn’t win in the fall, but his example still inspires conservatives, making clear that extremism is embedded in the DNA of the modern conservative movement, even though it was often not the dominant strand.

In 1964, the GOP ceased to be the party of Lincoln and became the party of Southern whites. As I now look back with the clarity of hindsight, I am convinced that coded racial appeals had at least as much, if not more, to do with the electoral success of the modern Republican Party than all of the domestic and foreign policy proposals crafted by well-intentioned analysts like me. This is what liberals have been saying for decades. I never believed them. Now I do, because Trump won by making the racist appeal, hitherto relatively subtle, obvious even to someone such as me who used to be in denial.

In fairness, many Republican voters and their leaders, from Wendell Willkie to Mitt Romney, have been a lot more moderate. Their very centrism stoked the fury of some on the right. The pattern was set early on, in 1964, with Phyllis Schlafly’s best-selling tract “A Choice Not an Echo.” Schlafly was baffled why Republicans candidates had lost presidential elections in 1936, 1940, 1944, 1948 and 1960. “It wasn’t any accident,” she wrote, ominously. “It was planned that way. In each of their losing presidential years, a small group of secret kingmakers, using hidden persuaders and psychological warfare techniques, manipulated the Republican National Convention to nominate candidates who would sidestep or suppress the key issues.” These nefarious “kingmakers” were New York financiers who supposedly favored “a policy of aiding and abetting Red Russia and her satellites.” And how did these “kingmakers” manipulate the GOP? By promulgating “false slogans” such as “Politics should stop at the water’s edge.” In other words, for Schlafly the very idea of bipartisanship was evidence of incipient treason.

This was not the ranting of some marginal oddball. Schlafly was one of the leading lights of the right who in the 1970s would lead the successful campaign against the Equal Rights Amendment. Trump’s claim that he is going to “Make America Great Again” — after it has been betrayed by disloyal elites — is simply an echo, as it were, of Schlafly’s conspiratorial rants.

The history of the modern Republican Party is the story of moderates being driven out and conservatives taking over — and then of those conservatives in turn being ousted by those even further to the right. A telling moment came in 1996, when the Republican presidential nominee, Bob Dole, visited an aged Barry Goldwater. Once upon a time, Dole and Goldwater had defined the Republican right, but by 1996, Dole joked, “Barry and I — we’ve sort of become the liberals.” “We’re the new liberals of the Republican Party,” Goldwater agreed. “Can you imagine that?”

The ascendance of extreme views, abetted in recent years by Fox News, Newt Gingrich, Sarah Palin and the tea party movement, increasingly made the House Republican caucus ungovernable. The far-right Freedom Caucus drove House Speaker John A. Boehner into retirement in 2015. His successor, Paul D. Ryan, lasted only three years. Ryan’s retirement signals the final repudiation of an optimistic, inclusive brand of Reaganesque conservatism focused on enhancing economic opportunity at home and promoting democracy and free trade abroad. The Republican Party will now be defined by Trump’s dark, divisive vision, with his depiction of Democrats as America-hating, criminal-coddling traitors, his vilification of the press as the “enemy of the people,” and his ugly invective against Mexicans and Muslims. The extremism that many Republicans of goodwill had been trying to push to the fringe of their party is now its governing ideology.

That’s why I can no longer be a Republican, and in fact wish ill fortune on my former party. I am now convinced that the Republican Party must suffer repeated and devastating defeats beginning in November. It must pay a heavy price for its embrace of white nationalism and know-nothingism. Only if the GOP as it is currently constituted is burned to the ground will there be any chance to build a reasonable center-right party out of the ashes. But that will require undoing the work of decades, not just of the past two years.