Rep. Chris Van Hollen defeated Rep. Donna F. Edwards in Maryland's heated Democratic Senate primary. Edwards criticized the state party for ignoring women and people of color after her loss. (WUSA9)

Rep. Chris Van Hollen defeated Rep. Donna F. Edwards in Maryland's heated Democratic Senate primary. Edwards criticized the state party for ignoring women and people of color after her loss. (WUSA9)

It’s the year of the outsider. But in Maryland on Tuesday, establishment Democratic candidates won up and down the board.

Veteran politicians won in Maryland’s 4th and 8th congressional district primaries and in Baltimore’s mayoral race. In the marquee event — the Democratic contest for Senate — Rep. Chris Van Hollen, the ultimate insider, swamped his rival, Rep. Donna F. Edwards, who has clashed with party leaders.

“For all the anti-establishment talk, the establishment exists for a reason — it exists because it’s been successful, it exists because there’s a machine,” said Todd Eberly, a political science professor at St. Mary’s College of Maryland. “They know how to get out the vote, they know how to target and, here in Maryland, it seems that the establishment is still pretty strong.”

Among Democrats voting in Maryland, there was little of the angst seen elsewhere. Exit polling found that 62 percent of primary voters Tuesday said they wanted the next president to continue President Obama’s policies. Only 22 percent said they prefer a more liberal agenda, while 11 percent wanted a less liberal approach.

Among white voters happy with the president, Van Hollen beat Edwards by a whopping 85-point margin.

One reason outsiders struggled in Maryland is that the state has closed primaries, and voters cannot change parties in the three weeks before the election.

“The only discernible unrest among Democratic voters appears to be in Baltimore city, as a direct response to Freddie Gray,” said Keith Haller, a pollster and strategist in Maryland.

State Sen. Catherine E. Pugh won the primary for mayor in Baltimore, with the endorsement of Rep. Elijah E. Cummings.

“As a perceived outsider, it makes it extremely difficult to run against a strongly preferred establishment candidate, even with an arsenal of hand grenades,” Haller said.

In Montgomery County, the anti-politician vote did have some charge. Former Marriott executive and news anchor Kathleen Matthews and millionaire wine merchant David Trone together took over 50 percent of the vote.

But in the end, the winner was state Sen. Jamie B. Raskin who, like Van Hollen, benefitted from the support of state leaders and some unions with their precinct captains, phone banks and ground troops.

“Congresswoman Edwards lacked that kind of machinery and couldn’t be as effective,” said Matt Verghese, a former Democratic Party spokesman who backed Van Hollen. “We say that endorsements don’t matter, but in a primary election when you have support from established figures who know how to win their districts and their counties, bringing those resources to bear makes a big difference.”

1 of 26 Full Screen Autoplay Close Skip Ad × On the ground in Maryland for the primary election View Photos Rep. Chris Van Hollen, a Democratic candidate for U.S. Senate, defeated his challenger, Rep. Donna E. Edwards. Caption Rep. Chris Van Hollen (D), a U.S. Senate candidate, defeated his challenger, Rep. Donna Edwards (D). April 26, 2016 Election official Jordan K. Johnson heads to open the doors at Eleanor Roosevelt High School in Greenbelt, Md., a polling site. Mark Gail/For The Washington Post Buy Photo Wait 1 second to continue.

Van Hollen had the backing of African American county executives in both his home base of Montgomery (Isiah Leggett) and in Edwards’s Prince George’s County (Rushern L. Baker III), as well as help from several state lawmakers.

One Prince George’s Democrat said that when Van Hollen’s campaign was ready to write off the county based on polls showing Edwards would dominate, party leaders convinced him to keep spending money there.

Baker had advised Van Hollen to spend time in Edwards’s back yard and build connections with the county’s faith community.

“I thought he could make his case to anybody here,” Baker said“I told him to go to the heart of the congresswoman’s district,” Baker said. “I thought he should go there and talk to people in places where they know her but don’t know him.”

A coalition of African American women, including former state senator Gloria Lawlah and Sen. Joanne C. Benson (Prince George’s) introduced Van Hollen to a network of voters.

That helped Van Hollen “turn a corner,” Baker said. “It carried more weight than Rushern Baker saying Chris is a great guy.”

The result: Van Hollen took 30 percent of the vote in Prince George’s. Edwards got less than 20 percent in Montgomery.

Thanks to his connections and loyal base he was able to turn out voters without investing heavily in field operations, which allowed him to devote funds to television ads and mailings that helped drown out the super PAC campaigns boosting Edwards.

“There’s some truth to the fact that in politics relationships matter,” agreed one Edwards supporter who asked for anonymity to speak freely. “Chris Van Hollen did a really good job with African American endorsements — not just politicians but clergy, pastors, and civic leaders who helped bring out the vote.”

Valerie Ervin, a former Montgomery County Council member and an Edwards supporter, said Edwards was still paying the price for bucking the establishment when she unseated Democrat Albert Wynn eight years ago.

“They never got over that,” Ervin said.

Ervin said complaints about Edwards’s constituent services, her relationships with other legislators, her record and effectiveness were all embellished though a whisper campaign to undermine the lawmaker’s candidacy. The rumors were repeated so often that they took on the semblance of truth, she said.

“There was so many ways they whispered their way to demeaning a woman of a lot of substance,” she said.

But Edwards also couldn’t count on some of the allies who helped her take down Wynn in 2008. Unlike Wynn, a conservative ex-lawmaker, Van Hollen is a progressive with strong relationships with key groups within the Democratic coalition.

Scott Clement and Robert McCartney contributed to this report.