In an election defined by anti-establishment energy and anger, the two parties are now diverging as Republicans fully embrace an outsider as their presidential nominee and Democrats line up behind a quintessential insider.

Republicans seem certain to nominate a bomb-throwing insurgent in celebrity real estate mogul Donald Trump or, should he fall short, Sen. Ted Cruz of Texas, while Democrats are consolidating around a guardian of the status quo, former secretary of state Hillary Clinton, who all but locked up the nomination with decisive victories in Tuesday’s primaries.

The successes of Trump and Clinton underscore important nuances in the sentiments coursing through the two parties. While voters in both share a frustration with the state of the nation’s economy and politics, Republicans blame their own leaders as much as anybody else and are, therefore, more eager for a radical fix, whereas Democrats still believe their elected leaders can bring change from within.

“It’s fundamentally different,” said David Axelrod, a Democratic strategist and architect of President Obama’s presidential campaigns. The GOP “is in full-out revolt — not just a revolt against government, but a revolt against their own party. . . . But Democratic voters appear to be choosing candidates who look like people who can work for institutional change within the institution rather than fighting for it from the fringe of the institutions.”

This dynamic played out Tuesday beyond the presidential level as well. In a pair of hotly contested Democratic Senate primaries, establishment favorites — Chris Van Hollen in Maryland and Kathleen McGinty in Pennsylvania — defeated more liberal, insurgent challengers.

“I think Democrats really want to win, and they’re not willing to sacrifice winning to ideology and grievance, which I think in the Republican Party is the case,” said Robert Shrum, a strategist who is a veteran of Democratic presidential campaigns.

In a GOP riven by dissent and distrust, Trump unquestionably has tapped into the frustrations more effectively than any other candidate. His challenge now is to unite his fractured party and expand his appeal beyond it to voter blocs that have found his candidacy divisive.

By contrast, Clinton must demonstrate that a politician with deep establishment roots can channel voters’ simmering anxiety over economic conditions and their dissatisfaction with political elites.

“I think she has to tap into the economic anxiety that leads Americans to think all the systems are breaking down,” said Bill Burton, a Democratic strategist and former Obama aide. “She has to stay authentic to who she is but hear and understand what Americans who feel stuck in the lower-middle class are feeling.”

Stan Greenberg, a longtime Democratic pollster, noted that an overwhelming majority of Republican voters have supported outsider candidates, from Trump and Cruz to early interest in retired neurosurgeon Ben Carson and former technology executive Carly Fiorina.

Republicans, Greenberg said, are angry at their leadership’s inability to check or counter Obama.

“No one has stopped Obama,” he said. “No one has stopped the Democrats from governing. So there’s anger at the leadership of their party. Democrats generally like their leaders.”

Democratic presidential candidate Hillary Clinton hit back at GOP front-runner Donald Trump's comments about Clinton playing "the woman's card," after the April 26 primaries. (Hillary Clinton)

Democrats, instead, channel their anger at Wall Street, big corporations and other ­economic-based complaints, Greenberg said, and the party as a whole has shifted to the left on these issues over the past few years.

Clinton’s challenger, Sen. Bernie Sanders of Vermont, is not giving up and has vowed to soldier on until primary voting ends in June, although his campaign said Wednesday that it would shed “hundreds” of staffers. Sanders spokesman Michael Briggs characterized the layoffs, first reported by the New York Times, as a move to “right-size” with only a few contests remaining on the Democratic calendar.

Sanders plans to focus much of his time and resources in coming weeks on California, which holds its primary on June 7 and awards the largest single trove of delegates.

Regardless of the outcome of the voting, Sanders wants to influence the party’s agenda at the Democratic National Convention. A challenge for Clinton will be to incorporate his progressive ideals — especially on trade and Wall Street regulations — into the structures of her campaign and her party in a way that satisfies him and his millions of supporters.

“He’s got a big following egging him on,” said Sen. Dianne Feinstein (D-Calif.), a Clinton backer. “I think the following has to understand it’s getting more and more assured every day what the outcome will be, and work together, across our party, to have a platform that represents the views of Democrats.”

In 2008, after the divisive primary season concluded, Feinstein opened her Washington manse to host a secret unity meeting between Obama and Clinton. She said she would reprise that role for Clinton and Sanders. “I’d be very happy to offer that,” Feinstein said.

Veteran Democratic operatives and officeholders said the ­Clinton-Sanders divide is typical of past contests — Obama vs. Hillary Clinton in 2008; John Kerry vs. Howard Dean in 2004; Al Gore vs. Bill Bradley in 2000; Bill Clinton vs. Jerry Brown in 1992 — and does not represent a unique or fundamental challenge to bringing the party together for a general election.

“There has always been a renewing wellspring of enthusiasm,” former Wisconsin governor Jim Doyle (D) said.

Doyle, who supported Obama in 2008 and now backs Clinton, drew a comparison between the Democrats’ last nomination fight and the current one. “The difference this time is that Hillary Clinton has been a much better candidate, for one thing,” he said. “And, with all due respect to Bernie Sanders, he’s not Barack Obama.”

Top Democrats take pride in how smoothly their party’s primary battle is shaping up, relative to the Republicans.

On Wednesday, as Sanders sounded some conciliatory notes and acknowledged the long if not impossible odds of him overtaking Clinton, Cruz dug in for what he hopes will be a long and contentious fight with Trump. A day after his primary losses made it mathematically impossible for him to clinch the nomination on a first convention ballot, Cruz took the unusual step of naming a vice presidential running mate, Fiorina, a fellow anti-establishment outsider.

“We are moving to that inevitable moment where the nomination is clear, and I think we’re doing it in a very positive fashion, quite a contrast to the other side,” Sen. Richard J. Durbin (D-Ill.) said.

One reason Democrats exhibit relatively more cohesion is because they are led by Obama in the White House, whereas Republicans have been out of executive power for eight years.

“That’s helped them a lot,” Rep. Tom Cole (R-Okla.) said. “It’s very frustrating for Republican voters to have control now of both houses, and [Democrats] still get to play goalie down there at 1600 Pennsylvania Avenue.”

Still, the anti-establishment frustrations have influenced both nominating contests — and Clinton’s challenge will be to show that she understands that mood and demonstrate that she has the ability to do things to ameliorate those feelings.

“That anger isn’t going to go away,” Democratic strategist Chris Kofinis said. “It is a reflection of economic anxiety and the complete lack of confidence in the political establishment of both parties to fix it. . . . I think [Washington] completely missed what’s been going on.”

Kofinis said Clinton’s team should not be complacent about the challenge that Trump presents. “I imagine some Democrats who look at Trump roll their eyes and say, ‘Never, never, never,’ ” he said. “I think that would be a mortal strategic mistake. He has tapped something real.”

John Wagner in West Lafayette, Ind., contributed to this report.