After the 2014 midterm elections, the Republican establishment took something of a victory lap. Republicans won nine seats to retake control of the Senate after prevailing in a series of messy primaries that pitted incumbents and establishment-minded candidates against tea-party-oriented outsiders. In the 11 contested GOP primaries that year, Republicans didn’t nominate a single candidate that party leaders viewed as unelectable.

Republicans celebrated the results, clearly believing they had defeated the tea-party threat. But that enthusiasm masked the growing influence of the party’s grassroots, one that is reemerging with a vengeance in this year’s presidential race. In fact, examining the results of those Senate primaries is like looking into a crystal ball predicting the rise of a grassroots movement pining for outspoken conservative outsiders—with minor-league versions of Donald Trump, Ben Carson, and Ted Cruz coming awfully close to stunning upsets in the process.

“Anybody who was involved in 2014 could see the dynamics for 2016 coming. You have a really angry electorate who’s desperate for change in Washington but doesn’t trust either party and doesn’t trust anyone who has spent time in Washington,” said Henry Barbour, a Republican national committeeman who aided Sen. Thad Cochran’s heated primary victory. “They’re hungry for someone to tell them what it is they want to hear. Donald Trump has tapped into that.”

History is written by the winners, so it’s understandable that names such as Joe Carr, Milton Wolf, and Chris McDaniel are hardly remembered in 2016. But it’s still remarkable how close some of the most entrenched members of the Senate came to losing against virtual nobodies whose main political argument was that they weren’t part of the mess in Washington.

Of the five GOP senators facing credible primary challenges in 2014, three won reelection with less than a majority of the vote, and no one topped 60 percent. Establishment-oriented Senate candidates in North Carolina and Alaska ended up winning heated primaries with barely over 40 percent of the Republican vote.

There are striking comparisons between the Senate insurgents of 2014 and the presidential-campaign outsiders of today. Like Carson, Wolf was a physician with little political experience, but even after proving he wasn’t ready for the scrutiny of a statewide campaign—he posted patient X-rays on his Facebook page—he nonetheless held Sen. Pat Roberts to 48 percent of the vote.

Like Cruz, Carr was a bomb-throwing backbencher in the state legislature whose claim to fame was his opposition to immigration reform. Yet despite spending what would have been a tiny fraction of Sen. Lamar Alexander’s campaign fortune and getting little media attention, he held the Tennessee political icon to under 50 percent of the vote and came within nine points of victory.

Like Trump, Matt Bevin was a brash, wealthy businessman who had the temerity to challenge his party’s leader head-on. Even though he was unsuccessful in defeating Senate Majority Leader Mitch McConnell, he now is sitting pretty as governor of Kentucky.

McDaniel was a forerunner to both Trump and Cruz. He made his mark in the Mississippi Senate as an uncompromising tea-party conservative, but a trail of racially-charged rhetoric made him persona non grata to party leaders. In another parallel to Trump, McDaniel was immune to nearly any attack Republicans threw at him. It took a last-minute effort from Cochran’s campaign persuading African-Americans to vote for a Republican in the runoff to pull off a narrow victory.

All these candidates ended up losing, but not because the Republican electorate had become more pragmatic. Instead, they lost because party leaders and allied outside groups took aggressive steps to blunt the appeal of the outsider candidates from the beginning. McConnell threw the opposition book at Bevin, accusing him of being a fake conservative, of falsifying his resume, and of not paying back taxes. The U.S. Chamber of Commerce ran expensive advertising campaigns boosting their favored candidates, while American Crossroads attacked the credibility of the tea-party challengers. In Mississippi, Cochran pulled off an unlikely victory by persuading African-Americans to vote for the senator. (That effort was aided by Barbour, who ran Cochran’s anti-McDaniel super PAC.)

In short, party leaders recognized the intraparty threat early on, and engineered a strategic game plan to ensure that the most electable nominees emerged in the primaries. That’s not happening at all in this year’s presidential primary, where the establishment appears content to watch its most electable candidates fight amongst themselves—as Trump continues to comfortably lead in national and most statewide polls.

Consider: Despite being the front-runner, Trump has almost entirely avoided attack ads against him, from both rival campaigns and outside groups. Outside GOP organizations have shown little interest in organizing against a candidate they all view as unelectable against Hillary Clinton. Candidates are so focused on their short-term interests that they’re neglecting the bigger picture for the party. If Trump wins Iowa and New Hampshire—blowing up the theory that his support will dissipate as voting nears—any efforts to blunt his appeal will be too little, too late.

“Running Cochran’s campaign gave me a different perspective than some—and helped me understand Trump as soon as it was apparent he was connecting with voters,” said Barbour. “I’ve seen this movie before.” Except this time, no one is playing Barbour’s role as the captain steering the party ship away from danger.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.