While all eyes were on the presidential contests in the five states holding primaries Tuesday, voters in Maryland and Pennsylvania also made big decisions down the ballot in high-stakes congressional primaries.

In perhaps the most hotly contested race, Maryland Rep. Chris Van Hollen beat Rep. Donna Edwards to become the Democratic nominee to replace retiring Democratic Sen. Barbara Mikulski, who has held the seat for 30 years.

Van Hollen ran as a pragmatic progressive who could reach across the aisle, while Edwards campaigned on her commitment to liberal principles.

The contest became a nasty battle over race, gender and personality; Edwards, if elected, would have been only the second black female senator. Edwards also criticized Van Hollen for allegedly being willing to compromise on principles for the sake of a deal.

In his victory speech, Van Hollen noted Mikulski's commitment to her constituents.

"And so tonight, I want to say to all Marylanders, whether you are from Baltimore city or Baltimore County to the Baltimore area, whether you are from the Washington suburbs or from Western Maryland or Southern Maryland or the Eastern Shore, I will fight hard for you every day in the United States Senate," Van Hollen said.

Ex-Lt. Gov. Anthony Brown won the primary for Edwards' congressional seat. Brown had loaned hundreds of thousands of dollars to his bid for Congress as he attempted to bounce back after losing the governor's race in 2014 to Republican Larry Hogan.

Meanwhile, Jamie Raskin defeated businessman David Trone and Kathleen Matthews, a former newswoman and wife of MSNBC host Chris Matthews, in the House Democratic primary to succeed Van Hollen.

Republicans are hoping to ride Hogan's popularity in November to pick up the crucial Senate seat in a state where they face an uphill climb, outnumbered 2-1 by Democrats. President Obama won the state comfortably in 2012.

Kathy Szeliga emerged the winner in a crowded Republican field.

"Governor Hogan's successes and support in Maryland, including with Democrats, prove that Marylanders like the change he's bringing to our state, and they will support a candidate, like me, who will bring that same real change to Washington," Szeliga said in her victory speech.

In Pennsylvania, Democrats chose former environmental official Kate McGinty over former U.S. Navy admiral Joe Sestak as their Senate nominee to run against Sen. Pat Toomey.

Sestak had spent two terms in the House of Representatives and narrowly lost in his 2010 Senate bid to Toomey.

Obama threw his weight behind McGinty, while Vice President Joe Biden has campaigned with her. She has also picked up the approval of the Democratic Senatorial Campaign Committee (DSCC) and Emily’s List, a group that helps elect Democratic women to office.

Polls had shown Sestak with a narrow lead, but on election night McGinty took the spoils.

Democrats expressed confidence she could beat Toomey in November.

“We are proud to congratulate Katie McGinty on her victory in tonight’s primary. Katie begins the general election in a strong position to defeat Senator Pat Toomey,” the DSCC said in a statement. ”As the ninth of ten kids and the first in her family to go to a four-year college, Katie understands the issues facing working folks in Pennsylvania, and she is ready to tackle those issues with commonsense solutions.”

Also in Pennsylvania, longtime Rep. Chaka Fattah became the first House member of the 2016 cycle to lose his seat in a primary. State Rep. Dwight Evans defeated Fattah, who was indicted on corruption charges last year. His trial is scheduled to start next month.

The seat in urban Philadelphia is highly Democratic and so Evans is likely to win election in November. 

Fox News’ Chad Pergram and The Associated Press contributed to this report.