Most of the “Never Trumpers” who opposed Donald Trump’s candidacy in 2016, such as pundits Ben Shapiro, Glenn Beck and Erick Erickson, have now come around to support the president. How can we explain this shift?

We don’t have to wonder. The very same thing happened in 1964, when party loyalty and ideological similarity convinced moderate Republicans to embrace the controversial candidate upending their party. In the late spring that year, as it became increasingly likely that Sen. Barry Goldwater (Ariz.) had a clear path to the Republican nomination for the presidency, twin fears gripped the then-formidable moderate wing of the party: first, that Goldwater might bring catastrophic loss to the Republican Party, and second, that if he were to win, it would bring a dangerous man to the White House.

But rather than going to war against Goldwater, the moderates, led by former president Dwight Eisenhower, first vacillated in their criticism and then relented, ultimately offering active support for their putative enemy.

Their actions help explain how a shared enemy and ideological affinities often lead political figures to overcome doubts they once had about the fitness and extremism of the leader of their party.

Of the moderates, Eisenhower’s behavior is especially telling. He should have been leading the charge against Goldwater. After all, the Arizona lawmaker and author of “The Conscience of a Conservative” had denounced the social welfare policies of his administration as a “dime-store New Deal.” And according to the journalist Theodore H. White, author of “The Making of the President” series, “Eisenhower was appalled at the prospect of Goldwater’s nomination.”

Yet the former president refused to publicly or explicitly denounce Goldwater. Instead, he whipsawed from private criticism of Goldwater to loyalty to his party, seeming to endorse even some of Goldwater’s more extreme ideas.

Consider, for example, the widely reprinted front-page piece Eisenhower wrote for the New York Herald Tribune in late May 1964, listing attributes for the next Republican president. Although never mentioning Goldwater, the list offered a frontal attack on Goldwaterism: support for civil rights, domestic spending programs and the United Nations. But within a week, Eisenhower walked back this stunning rebuke, saying any interpretation of the piece as a criticism of Goldwater was a “complete misinterpretation.” He scolded reporters, “You people read Mr. Goldwater out of the party, I didn’t.”

In June, Eisenhower again seemed on the brink of full-throated opposition. He prodded Pennsylvania Gov. William Scranton to run, before reversing course and telling Scranton that he did not wish to be part of any “cabal” to stop Goldwater. He also refused to meet with 27 Republican anti-Goldwater legislators in Pennsylvania who wanted him to endorse Scranton, even as they presciently warned him that “Eisenhower-moderate Republicanism will be irreparably harmed if you remain out of this fight.”

At the Republican convention in July, the former president moved from refusing to challenge Goldwater to endorsing the nominee’s hard-right philosophy. Eisenhower’s speechwriters had prepared a conciliatory address, which both endorsed Goldwater and praised the principles of moderation with which the former president was so closely associated. But in the last third of his speech, the tone changed dramatically as Eisenhower read seemingly discordant remarks that he had inserted at the last minute.

He began with articulating a shared grievance about the media, which “couldn’t care less about the good of our party.” Then he went even further, sympathizing with some of Goldwater’s more controversial positions on civil rights and the welfare state, two of the core principles that had so differentiated moderate Republicans like Eisenhower from Goldwater and his supporters.

The former president notably wielded the language of what had only recently been labeled the “white backlash” against the civil rights movement. He warned against “maudlin sympathy for the criminal,” cautioning against transforming him into “a poor, underprivileged person who counts upon the compassion of our society and the laxness or weakness of too many courts to forgive his offense.” The crowd delighted in this racialized dig at the liberalism of the Supreme Court, which had recently proclaimed “the right to remain silent.”

Rather than emphasizing the chasm between moderation and extremism, the former president highlighted his points of agreement with Goldwater, seemingly out of ideological conviction rather than simple party loyalty. This continued over the next few months. Several times, he went out of his way to endorse Goldwater’s proposal to privatize the Tennessee Valley Authority, which he described to CBS’s Walter Cronkite as “not a radical move at all — it’s just getting private enterprise into a lot of things that are now the government’s doings.” Employing the language of the anti-New Dealers, he also called the TVA “creeping socialism.”

This embrace culminated with a “Conversation in Gettysburg,” a half-hour TV program produced by the Republican National Committee and aired nationally on NBC in September 1964. The former president and the nominee discussed their common ground, with Eisenhower dismissing the charges that Goldwater was a warmonger as “actual tommyrot.” He also volunteered the view, closely associated with conservatism, that “too much power” is “centralized in Washington” and represented “a danger to our freedom.”

Most moderates — including Scranton and Nelson Rockefeller, Goldwater’s chief rivals — joined Eisenhower in endorsing the Republican ticket. But Eisenhower’s conduct especially disappointed and confused many, even leading some to describe the decorated war hero as lacking resolve. One Washington correspondent wrote in early June, “bewildered Republicans” were asking “whatever happened to Ike?” A Herblock cartoon in The Washington Post, featuring the text, “On Second Thought, Turn Back. And Forget it. Let’s not be part of a cabal to stop anybody,” contrasted Eisenhower’s decisive and heroic actions in 1944 with his indecision two decades later. The cartoon shows a baby-faced Ike slumped, his head resting on his desk. Behind him is a picture of him standing erect, in command on D-Day.

But this assertion that the decorated general lacked backbone was, in reality, a misdiagnosis. Robert L. Riggs of the Louisville Courier Journal hit on a far more compelling explanation for Eisenhower’s behavior, one with major import for understanding Never Trumpers today. “Actually, Eisenhower’s domestic views were never very far from Goldwater’s,” he explained. Indeed, the significant differences between the two wings of the GOP on civil rights and internationalism actually obscured both strong partisan loyalty and underlying philosophical agreements about the size and scope of government.

This reality helps explain why Never Trumpers are now endorsing the president. They, too, have been assailed for lacking courage or principles. But the declining opposition is less about a paucity of moral courage and more about a lack of sufficient disagreement. Trump may have been a controversial candidate — and he remains so as president — but his governing agenda has largely pleased conservatives.

One Never Trumper who came around and explained his reasoning on Reddit exemplified how ideology and a sense of us vs. them reminiscent of Eisenhower’s Republican convention jab at the press has served as a glue that has helped overcome once-strenuous GOP opposition to Trump. After noting the “ravenous hatred” of Trump, the poster wrote, “I went back and actually researched Trump’s platform, and I didn’t hate it as much as people said I should.”

This answer precisely combines the two strands that seemed to drive Eisenhower to Goldwater: circling the wagons because of perceived unfair criticism and strong dislike of the opposition — what political scientists call “negative partisanship” — and then minimizing the ideological differences that prompted the opposition in the first place.

And it illuminates how the ideological convictions and partisan loyalty of most politicians lead them to embrace the leader of their party even if they find some of that person’s views and conduct distasteful. Today, that means swallowing Trump’s racism, ignorance and corruption in exchange for tax cuts, conservative judges, abortion restrictions and other policies Republicans and conservatives prefer. It offers a primer as to why the Never-Trump Republican is rapidly becoming extinct, and also why figures like Goldwater, and now Trump, can play such an outsize role in transforming a party’s agenda: unless their opponents are willing to endorse the other party, they have little choice but to capitulate.