ANNAPOLIS, Md. — Maryland state Sen. Sarah Elfreth defeated former U.S. Capitol police officer Harry Dunn in a crowded congressional Democratic primary on Tuesday.

Elfreth prevailed in a primary with 22 candidates to replace outgoing Rep. John Sarbanes, who announced in October he would not seek a 10th term. The heavily Democratic 3rd Congressional District runs between Baltimore and the nation's capital.

During the campaign, Elfreth highlighted her work as a state legislator, getting bills passed and helping her constituents. She also won endorsements from the state's teachers union and environmental groups.

Elfreth won her first Maryland Senate term in 2018, becoming the youngest woman elected to the state Senate. As a legislator in a district next to the Chesapeake Bay, she has supported legislation to boost the oyster population in the nation's largest estuary, invest in clean energy jobs and take action against rising sea levels.

Elfreth said Tuesday night she would continue to be a champion for the bay. She also said she was excited to join two other Maryland women who won their Democratic primaries, including Prince George's County Executive Angela Alsobrooks for U.S. Senate and April McClain Delaney, who won the nomination in the state's 6th Congressional District.

Maryland currently does not have a woman in the state's congressional delegation.

''We're really going to prioritize reproductive health issues, prioritize affordable child care, prioritize the kitchen-table issues that really matter to families,'' Elfreth said after her primary victory.

Supporters praised her for being accessible and helpful to constituents, as well as for her positions on environmental issues.

''She's very much in the trenches, and you can call her on the phone at any time and she'll call you back and talk about whatever it is that you want to talk about,'' said Susan Zevin, who voted for Elfreth at Annapolis High School on Tuesday.

Voters who supported Elfreth underscored their familiarity with her work as a state senator as a reason for backing her candidacy.

''She did a great job in the state, so I'm very excited to see her go for the Congress,'' Jeff Hackett said after voting for Elfreth and for Alsobrooks for Senate.

Gov. Wes Moore, a Democrat, said Elfreth's work ethic is well-known around the state capital.

''Sarah will fight to restore abortion access across the nation and prevent any bans from coming to Maryland," the governor said in a statement from the state Democratic Party. ''She is a champion for common sense gun safety and will protect our environment, especially the Chesapeake Bay.''

Dunn's celebrity helped draw national attention to the primary to replace Sarbanes. Supporters of the former officer praised Dunn as a defender of democracy. He testified at a hearing of the House committee that probed the Jan. 6 attack at the Capitol.

Some voters who ended up supporting Elfreth instead described it as a tough choice, describing Dunn as a hero.

Dunn, who announced his candidacy in January, a day before the third anniversary of the violent attack at the Capitol by a mob of Donald Trump supporters that disrupted the certification of the 2020 presidential election for Joe Biden, said voters regularly thank him for serving as a police officer. He campaigned on being on the front lines defending democracy.