The Democratic establishment, led by President Obama, came out on top Tuesday, delivering a string of blows to progressive challengers who party leaders decided were not their best candidates to help claim the Senate this fall.

The fallout from these victories remains to be seen. The sheer amount of money poured into Senate primaries in Pennsylvania and Maryland — close to $30 million in Democrat-on-Democrat spending — along with the vitriol of the intraparty attacks begs the question about how unified Democrats will be in November.

“I think people will come back on board, but it’s going to take some work,” Sen. Jon Tester (Mont.), chairman of the Democratic Senatorial Campaign Committee, said in an interview Tuesday afternoon.

The establishment triumph demonstrates that Democrats have not drifted anywhere close to the upside-down world of Republican primaries, in which incumbents often run away from party leaders to protect their ideological right flank.

But the unusually caustic nature of the two Democratic slugfests in Pennsylvania and Maryland showed that liberals, particularly well-funded outside groups, are willing to engage in death-match tactics similar to those of their conservative counterparts. They just haven’t found the same level of success, at least not yet.

Tester got what Democratic leaders wanted most: a convincing victory by their recruit in Pennsylvania, Katie McGinty, over the perennial thorn in their side, former congressman Joe Sestak.

The DSCC teamed up with a coalition of Emily’s List, labor and environmental groups to prop up McGinty, who had never won a race before. Together, they spent more than $4 million, funds that will not be available to Democrats in their crucial campaign to try to unseat Sen. Pat Toomey (R-Pa.) in November.

Most of that money was spent in the last three weeks in television and radio ads that told Pennsylvania voters, particularly the large black population in Philadelphia, that Obama had endorsed McGinty. To drive home that point, the president dispatched Vice President Biden to campaign with the political newcomer in Pittsburgh and then Monday in Philadelphia.

At DSCC headquarters and in Senate leadership suites, heads nodded approvingly when media trackers found that all four Philadelphia TV newscasts gave glowing coverage of Biden’s trip into a diner with McGinty at his side.

Senate Democratic leaders, who openly clashed with Obama during the 2014 elections, are publicly praising the White House’s engagement these days. Exhibit A is Obama’s endorsement of McGinty at a point she trailed badly to Sestak in public and private polling.

“He just did it with no muss, no fuss, in a very great way,” Sen. Charles E. Schumer (D-N.Y.), the next Democratic leader, told my colleague Juliet Eilperin.

Tester may be able to play a unique role as peacemaker.

He’s been playing the “good cop” role with candidates, recruits and various interest groups while Schumer plays “bad cop”. Sestak, for instance, despises Schumer — a reciprocated feeling — but he adores Tester.

A decade ago, Tester watched as Schumer and the DSCC not so quietly supported his leading primary opponent. Tester won anyway. His opponent never endorsed him in the general election against a Republican incumbent, but Tester went around the state talking to his rival’s supporters.

“Let them vent to me, I vented to them, and people came together,” Tester recalled.

“It ain’t about people, man,” he said. “It’s about getting into a position where you can affect change for the next generation, and if you keep that in mind, you bring people together.”

In Tuesday’s contests, Emily’s List, an iconic group with a 30-year record of increasing the ranks of female political leaders, found itself facing friendly fire over its role in both Pennsylvania and Maryland.

In the Keystone State, the group’s super PAC, Women Vote, sided with the establishment and ran a brutal ad hitting Sestak on entitlements, based on a couple of statements that gave vague praise of a deficit-reduction commission that recommended increasing the retirement age.

In Maryland, the group ran a multimillion-dollar campaign backing Rep. Donna F. Edwards (D), an anti-establishment African-American woman, over Rep. Chris Van Hollen (D), a well-liked lawmaker who House Minority Leader Nancy Pelosi (D-Calif.) frequently tapped as her lead negotiator in fiscal talks over the past five years.

If Tuesday proved anything, it’s that Obama is still a very popular figure in Democratic circles. One outfit, Harper Polling, found that three weeks before the primary Sestak led among African-American voters, 46 to McGinty’s 24 perecent. On Monday, after all the Obama-McGinty ads, those numbers had been flipped, with McGinty leading Sestak among black voters, 52 to 25 percent.

Obama even got a victory in the Pennsylvania attorney general’s race, endorsing Joshua Shapiro in a competitive primary. Shapiro, chairman of the County Commission in the state’s third-most populous county, Montgomery, was an early backer of Obama’s first presidential campaign. If Shapiro wins in November, Obama will have set up an ally for a shot at the governor’s mansion in the next decade.

The decisions inside the West Wing haven’t gone unnoticed among the party’s most liberal wing.

“For the White House to have endorsed, that stung,” John Fetterman, who finished third behind Sestak in the primary, said in an interview last week.

The mayor of Braddock, a town near Pittsburgh, Fetterman endorsed Obama during his 2008 Pennsylvania primary race against Clinton and was stunned to see the president siding with an acolyte of Ed Rendell, the former governor who helped Clinton rout Obama in that 2008 primary. McGinty served in Rendell’s Cabinet in Harrisburg.

Fetterman, who outperformed his public polling with almost 20 percent of the vote, hitched his wagon to the insurgent presidential campaign of Sen. Bernie Sanders. Party leaders have been careful in how they handle these progressive voters, knowing they need their energy and support in the presidential and congressional come fall.

Fetterman dislikes McGinty for her cutthroat campaign message accusing Sestak of wanting to cut Social Security and allow unlimited bonuses to Wall Street executives. “McGinty is running the most cynical race possible,” he said last week.

In Maryland, Van Hollen prevailed despite attack ads from liberal groups. Emily’s List went all in to try to defeat Van Hollen. That included providing financial support to a group that ran ads accusing Van Hollen of creating a loophole for the National Rifle Association in campaign finance legislation he pushed — at Obama’s behest — in 2010.

White House officials called for the ads to  be pulled, and by the time votes were cast, most Maryland Democrats believed Obama was privately pulling for Van Hollen.

But while Pennsylvania is a swing state and will be hotly contested in November, Maryland is almost certain to go Democratic and is unlikely to tip the balance of the Senate. The state has not elected a Republican senator since 1980.