When the Iowa results came in Monday night, it was clear that anti-establishment Republicans were on top. The onetime inevitable front-runner, Jeb Bush, barely registered. The bombastic and acerbic Ted Cruz, who has spent much of his career and campaign blasting Washington, came out on top. Donald Trump, certainly furious he did not win, still came in second. These are two Republicans who have spent as much time fighting their own party as they have the Democrats. Even Marco Rubio, who also put on a strong performance, was the darling of the Tea Party when he came to Washington, and he has continued to echo many of their arguments. As Peter Beinart wrote, Rubio’s recent surge in the polls is due to “borrowing Trump’s message while pledging to more effectively package it.”

Bill Clinton once said: “Democrats want to fall in love. Republicans just fall in line.” But that has never really been the case—and it certainly isn’t in 2016.

The civil war that has broken out among Republicans is nothing new. Though the GOP likes to think of itself as the orderly party, where politicians must politely wait their turn to run for office, this hasn’t been true for a long time. There is a deep-rooted tradition of maverick conservatives shaking up the status quo by running against the Republican establishment. Barry Goldwater did this against Nelson Rockefeller in 1964, though his landslide defeat against Lyndon Johnson put the strategy in doubt. It was Ronald Reagan who, nearly 40 years ago, perfected the tradition. In the process, Reagan created the template for the anti-establishment, conservative campaign style that has catapulted Trump and Cruz to the top of the Republican ticket.

During the 1976 Republican primaries, Reagan rocked the political world by challenging a sitting president, Gerald Ford, for the nomination. At the heart of this historic campaign was a fight against the Republican political establishment. Reagan blasted a broken Republican leadership and called for his party to shift rightward on domestic policy and national security. Everything about Washington, Reagan said, was broken—including his own party.

Reagan had been toying with the possibility of running for many years. The former Hollywood actor and General Electric spokesman had become a popular figure in conservative circles after his televised speech to support Republican Barry Goldwater’s 1964 run against Lyndon Johnson. He then proved his political chops as a two-term governor of California. In 1968, Reagan ran a half-hearted campaign for the nomination, but, with Goldwater’s disastrous rightward campaign fresh on the party’s mind, Reagan was sidelined.

Yet 1976 was different. Watergate and Vietnam had shattered Americans’ faith in the political system. The dire state of the economy—which struggled with inflation, unemployment, and energy shortfalls all at once—had created volatility in the electorate. And even though Ford had been a stalwart Midwestern Republican in the House of Representatives, many conservatives were totally fed up with the White House. Ford’s decision to pardon Richard Nixon had been a political disaster for a Republican Party seeking to recover from the wounds of Watergate. Although most Democrats would disagree, the right felt that the president was not nearly conservative enough. Even as he fought to cut spending and deregulate markets, conservatives thought that, like Nixon, Ford was making too many compromises with Democrats. On foreign policy, conservatives saw the situation as even worse: The administration seemed to genuinely support moderation. Then, Ford’s decision to continue détente—the controversial policy to ease relations with the Soviet Union—with Henry Kissinger at the top of his team made the right furious.

On November 20, 1975, Reagan announced his candidacy. Outlining the challenges facing the United States, Reagan said: “The root of these problems lies right here—in Washington, D.C. Our nation’s capital has become the seat of a ‘buddy’ system that functions for its own benefit—increasingly insensitive to the needs of the American worker who supports it with taxes.” Ford’s first instinct was to dismiss Reagan. “The simple political fact is that he cannot defeat any candidates the Democrats put up,” read Ford’s press release. “Reagan’s constituency is much too narrow, even within the Republican Party.” The president said that Reagan was just too extreme: “I believe that anyone to the right of me, Democratic or Republican, can’t win a national election.” Former President Nixon also downplayed Reagan as a “lightweight and not someone to be considered seriously or feared in terms of a challenge for the nomination.”

But Reagan didn’t need Washington Republicans. Like the Democrats, Republicans had reformed their nomination system so that the primaries and caucuses would determine who won the nomination rather than party bosses. More than any other candidate at the time, Reagan capitalized on the energies of the burgeoning conservative movement to build support among voters. The Young America’s Foundation organized fundraising events, and the conservative magazine Human Events sponsored radio addresses.

At first, Reagan honed in on domestic policy. He combined a sunny disposition about the future with harsh attacks on liberalism. As historian Rick Perlstein recounted in The Invisible Bridge, Reagan steadfastly ignored the troubling times Americans were living in. He insisted that the country remained strong and that the many critics of the American way were outliers who didn’t understand why the nation was great. Then he attacked—and he did so viciously. In New Hampshire, Reagan called on the federal government to transfer $90 billion from funds in its control over to states and localities. The statement caused a backlash. Reagan thrived in the controversy. When a reporter asked him what would happen to poor people living in states that didn’t spend the money on social services, he replied, “If a state is mismanaged, you can move somewhere else.”

In the early contests, Reagan struggled. Ford defeated him in New Hampshire, and went on to win in Florida, Massachusetts, and Vermont. Reagan’s campaign seemed almost out of steam. But rather than shifting to the center, Reagan doubled down, moving even more sharply to the right. He focused on foreign policy as he took an even tougher stance toward the Republican establishment. On Meet the Press, Reagan lashed out against détente: “It has been a one-way street. We are making the concessions; we are giving them the things they want; we ask for nothing in return.” Listening to his advisers, Ford literally stopped using the word “détente”—but it didn’t make a difference. Reagan warned his supporters that the president was conducting secret talks with the Panamanian government to turn control of the Panama Canal back to the Panamanians. When the John Birch Society heard the accusations, members placed bumper stickers on their cars: “Don’t give Panama our canal: Give them Kissinger instead!” Ford lashed back, warning that Reagan’s irresponsible approach would produce a “bloodbath.”

While campaigning in North Carolina, Reagan received the support of Senator Jesse Helms’s political organization, the National Congressional Club. Helms, a former conservative radio commentator, had built a vibrant grassroots movement in North Carolina that was a hub for right-wing activists. In March, Helms traveled across his state to build support for Reagan. The Club ran television advertisements that targeted disaffected Democrats. Other conservative organizations joined the effort, including the Young Americans for Freedom and the American Conservative Union. The strategy worked. Reagan won a major victory in the North Carolina primaries with 52 percent of the vote. The experts were shocked. Still, Reagan was struggling and needed another big victory.

On March 31, Reagan built on his North Carolina momentum by purchasing national airtime on NBC for $100,000. He replaced the half-hour sitcom The Dumplings to give a speech called “To Restore America.” Reagan mocked the administration for replacing the term “détente” with “peace through strength” while sticking to the same policies: Nobody was fooled, he said. He told his audience: “Peace does not come from weakness or from retreat. It comes from the restoration of American military superiority.” Dismissing Ford’s claims of economic recovery, Reagan made a strong case about the inefficiencies of public policy. His challenge to Washington framed the entire speech: “Now a self-anointed elite in our nation’s capital would have us believe we are incapable of guiding our own destiny.” Wall Street Journal reporter Dennis Farney wrote, “Interwoven throughout Mr. Reagan’s address was the anti-Washington theme he, as well as such Democratic candidates as Jimmy Carter, has made a centerpiece this year.” In his stump speeches, Reagan liked to say, “Washington is a colossal failure.”

The effort was paying off. Reagan continued winning. He enjoyed a huge victory in Texas, which put him right back into the competition. In Alabama, Georgia, Nebraska, California, and Indiana, President Ford suffered embarrassing defeats. An internal administration memo analyzed how Ford managed to lose Texas:

Turnout is very high. The people coming to vote or to the caucuses are unknown and have not been involved in the Republican political system before; they vote overwhelmingly for Reagan. A clear pattern is emerging; these turnouts now do not seem accidental but appear to be the result of skillful organization by extreme right wing political groups in the Reagan camp operating almost invisibly through direct mail and voter turnout efforts conducted by the organizations themselves.

The memo pointed to an elaborate network of activists and wealthy donors, like Joseph Coors, who were behind Reagan’s operation. “We are in real danger,” the memo concluded, “of being out-organized by a small number of highly motivated right-wing nuts.” Ford went on the attack: “We should exercise great caution,” he said, “before heeding the words of a man who obviously has no experience and little understanding of the complexity of national defense matters. Superficial arguments based on incomplete knowledge are fundamentally harmful rather than helpful.”

What bothered Ford’s people the most was that Reagan’s supporters seemed willing to bring down the party as the establishment knew it. The groups behind Reagan, they complained, displayed a “rule or ruin attitude toward the GOP.” Ford struggled to combat Reagan’s brilliant media skills. In what Newsweek called the “Year of the Outsider,” Reagan, like his Democratic counterpart, Carter, was “perceived as unsullied by Watergate, untainted by Vietnam and uncorrupted by a political system that isn’t working.” National Review saw the situation a bit differently. Ford was the old Republican Party. Reagan was the new: “In contrast to Ford’s Midwest-Northeast Republicanism, Ronald Reagan represents the powerful conservative movement that rose to dominance within the Republican Party during the 1960s.”

Going into the convention, the race was neck and neck. Ford mobilized all the muscle he could to round up delegate support at the convention. It worked. Ford secured the nomination—though barely (1,187 to 1,070) and with his candidacy in a badly weakened state. The final results could not be seen as a mandate. “Reagan was the dominating presence of the 1976 campaign,” quipped William F. Buckley Jr., “even though Ford was the formal victor.”

And so, Reagan’s brand of muscular, anti-establishment conservatism didn’t win out in 1976—the party establishment saved itself for the time being—but his campaign became the template for maverick conservatives in the decades to come. Four years later, Reagan used this combination of right-wing conservatism and anti-establishment attacks to win his way into the White House. Maybe that’s why, this year, its seems like almost all of the Republican nominees, with the exception of Jeb Bush and John Kasich, are borrowing from Reagan’s 1976 campaign. And if Trump or Cruz win the nomination—which would be one of the most surprising outcomes in recent political history—the party will have their architect, Ronald Reagan, to thank.