When Sen. Jeff Flake (R-Ariz.) took on President Trump at New Hampshire’s “Politics and Eggs” breakfast in March , he hinted that he might run in the 2020 Republican presidential primary: “I hope that someone does run in the Republican primary, somebody to challenge the president,” he told business leaders, who gave him a standing ovation in reply. In April , visiting New Hampshire, the first presidential-primary state, Ohio Gov. John Kasich (R) didn’t commit but said that in terms of a 2020 run, “all of my options are on the table.” A few weeks ago, he followed that up by telling CNN’s Jake Tapper, “The Republican Party left me,” but “I can bring that party back.”

Flake and Kasich could be among several Republicans taking the rare step of challenging their party’s incumbent president. Even if these two men don’t, someone should — must — run against Trump. This is the best way for the GOP to purge itself of Trump’s worst aspects and maybe even cause his downfall in the general election. For the party to sort out its internal contradictions, begin to repair Trump’s damage to the country and restore a bit of faith with the Americans he has most harmed — women, immigrants, African Americans — it needs a serious primary challenger, even if most Republicans today still support Trump.

Trump’s GOP has become an unworkable vehicle for the propagation of traditional conservative policy, such as free trade and democracy promotion. Trumpism is an organic creature, rooted in conservatism’s nativist, white-supremacist, post-civil-rights slipstream. But just because Trump seems dominant today doesn’t mean that anti-Trump principles — family values, for instance, or suspicion toward Russia, or deficit reduction, or simple decorum — can’t find an audience in a 2020 primary. Also, events out of Trump’s control (whether Robert Mueller’s methodical Russia investigation, North Korea’s nuclear program or a recession at home) could damage him within his party, making him far more vulnerable to a primary contest. “A lot of voters are getting tired of [Trump’s] act,” Fergus Cullen, a former chairman of the New Hampshire Republican State Committee, told The Washington Post in the wake of Flake’s rapturous reception.

A challenge still would not be easy, of course. Most Republicans like the state of Trump’s GOP just fine; there is no groundswell for a #NeverTrump-er to rescue the party. In the most recent CNN/SSRS poll, the president’s approval rating among Republicans was 86 percent.

The GOP may or may not face danger at the ballot box in 2018 and 2020, but it is doomed in the long run if no Republican stands for the principles that the party has for so long said it defends: governmental restraint and individual liberty. Ultimately, the best way for the GOP to change course — to repudiate Trump and his chaos-inducing, nativist, racist approach — isn’t rocket science: Some Republican must take on the president. And such a challenge would still have an effect, even if Trump won the nomination.

Serious primary challenges are hardly the only way to shift a party’s direction. From the abolitionists who helped create the Republican Party in the 1850s to the civil rights activists who forced Democrats to become the party of racial equality, from the Democratic Leadership Council’s efforts in the 1980s to recapture the political center to the tea party’s push to purge Republicans who suggested that even limited government action might be warranted, grass-roots movements and intra-party organizations have transformed each party’s agenda, leadership and identity.

But since 1968, serious primary challengers to incumbent presidents have been one of the more effective vehicles to push a party to change its ideas, rethink its core constituencies and remake its platform. Eugene McCarthy, Ronald Reagan, Edward Kennedy and Pat Buchanan helped sink the incumbent’s reelection chances and alter their parties’ direction over the long term. They endured ridicule from onetime allies because they had the gall to run against sitting presidents, but their campaigns kept alive within their parties alternate traditions and dissenting views, some of which became dominant over time.

McCarthy’s 1968 challenge to President Lyndon B. Johnson, which was impelled by growing antiwar sentiment, was premised on a theme that has a passing resemblance to a hypothetical Flake or Kasich bid. In his announcement speech in November 1967, the senator from Minnesota described his aim to tackle a “deepening moral crisis” and “restore to many people a belief in the processes of American politics.” Although most Democratic officials, including Johnson, treated his challenge as less than serious, the senator won 42 percent of New Hampshire’s Democratic primary vote. In defeat, he achieved some measure of victory: Four days later, Robert Kennedy declared his candidacy, dealing a blow to LBJ. By month’s end, the president had withdrawn from the race, hounded out by his unpopularity, the failed war in Vietnam, a splintering Democratic Party and McCarthy’s surprise showing. McCarthy helped bring young antiwar activists into Democratic ranks, and he ultimately helped establish a strong antiwar, anti-interventionist wing in the party.

Reagan’s spirited 1976 challenge to President Gerald Ford pivoted the GOP toward the former California governor’s anti-big-government, hawkish views. Reagan’s campaign was based on his notion of bringing an ever “more intrusive, more coercive, more meddlesome and less effective” government to heel. In addition, he vowed that conservatives, under his leadership, would reassert America’s military strength over the Soviet Union, and he decried a Washington that had become hostage to “forces that have brought us our problems — the Congress, the bureaucracy, the lobbyist, big business and big labor.” Despite losing numerous primary states to Ford, Reagan won enough to fall just 117 delegates shy of the nomination. From the ’76 convention stage, he forecast where a post-Ford GOP would go when he praised the party’s platform as “a banner of bold, unmistakable colors with no pale, pastel shades” and vowed to halt the “erosion of freedom that has taken place under Democratic rule.” Reagan’s anti-Washington themes would echo in GOP politics going forward, including in Trump’s 2016 antiestablishment campaign.

Ted Kennedy waged a somewhat quixotic bid to unseat President Jimmy Carter in the 1980 Democratic primary, and he, too, changed his party. Kennedy ran on the idea that Carter had abandoned Democratic principles of using government to lessen income inequality and fight for the underdog. “It’s time to have a real Democrat in the White House again,” he declared in 1979. Although he came under withering fire for his part in the drowning death of Mary Jo Kopechne at Chappaquiddick a decade before, and although he lost several early primary contests, Kennedy offered himself as an alternative to what he saw as Carter’s timidity. Government, he argued, should guarantee health care to all citizens and reduce the gap between the richest and the poorest Americans. Once again, he claimed, the Democratic Party would fight for “an America where the many who are handicapped, the minority who are not white and the majority who are women will not suffer from injustice . . . an America where the state of a person’s health will not be determined by the amount of a person’s wealth.”

The Kennedy campaign’s impact was more than ideological. By defeating Carter in New York and Connecticut, Kennedy shifted the party template to one that fit with Northeastern liberalism and further weakened the Democrats in the South. He proposed federal support for child care for working women, pledged to name the first female Supreme Court justice, and promised to sign an executive order prohibiting discrimination against gays and lesbians in federal hiring. In the long run, Kennedy’s campaign cemented Democrats as the party of traditionally disenfranchised minorities, helped give it an electoral advantage among women and sought (with mixed success) to put economic inequality at the center of its platform.

Potential Trump primary challengers should also understand how right-wing candidate Buchanan used his 1992 race against President George H.W. Bush to keep an alternate tradition alive within the GOP. Buchanan’s bid, in retrospect, was a marker on the road to Trumpism. He was attempting, wrote journalist Steven A. Holmes in the New York Times, “to change the direction of the conservative movement.” Buchanan drew support from conservatives furious that Bush had raised taxes; he blasted immigrants for supposedly stealing jobs from working-class white Americans, decried free trade (opposing NAFTA and calling Japan’s trade policies “predatory”) and proposed an isolationist turn for post-Cold War America. Buchanan won 38 percent of the New Hampshire Republican primary vote.

Even if most Republicans are satisfied with Trump’s performance, there are ideological fights within the GOP that remain to be had. And the primary process in 2020 is the party’s best shot at sorting out the contradictions between its reputed principles and its current leadership.

A primary campaign against a sitting president can be excruciating. Even the strong bids of the past couldn’t dislodge sitting presidents, save for McCarthy’s challenge to Johnson. Incumbents controlled too many delegates and too much of the party’s apparatus, and had built up so many chits. (Even LBJ, from the sidelines, ensured the nomination of his vice president, Hubert Humphrey.) Trump wouldn’t be an exception. The party’s machinery would endeavor to destroy a primary opponent’s character; his onetime allies would liken him to Judas for betraying his party and risking its hold on power. And should someone like Kasich mount a third-party bid, he could split the anti-Trump general-election vote and hand Trump another term.

Still, the campaigns by McCarthy, Reagan, Kennedy and Buchanan had a far greater impact than they might have imagined. Today, facing off against the most unpopular president in the history of public polling, a serious primary challenger has a chance to harm Trump’s reelection prospects and, even in defeat, to change the direction of a party that has abandoned its principles.