A former police officer who defended the US Capitol against rioters on January 6 2021 has announced he is running for Congress in Maryland.

Harry Dunn wrote on X, formerly Twitter, that he will be running in a crowded Democratic primary to replace Rep John Sarbanes, a Democrat who is not seeking re-election.

Mr Dunn made the announcement a day before the third anniversary of the attack at the Capitol that disrupted the certification of the 2020 election, saying in his campaign announcement that former US president Donald Trump was “hell-bent on finishing what he started” three years ago.

“On January 6, I defended our democracy from insurrectionists as a Capitol Police Officer. After, President Biden honoured me with the Presidential Citizens Medal,” Mr Dunn wrote in the announcement of his candidacy.

“Today, I’m running for Congress to stop Trump’s MAGA extremists and ensure it never happens again.”

Mr Dunn is running in Maryland’s 3rd Congressional District, which stretches between Baltimore and the nation’s capital. The race already has drawn five state legislators to run in the heavily Democratic district.

In a video Mr Dunn released on the social media site, he said he left the police force a few weeks ago after more than 15 years of service to make his congressional bid.

“I’m stepping into a new role today, but I can’t do it alone,” Mr Dunn said. “I believe everyone of us has a role to play in this fight. So join me. We’ve got a democracy to protect.”

Mr Dunn, who testified before the January 6 committee in Washington, told politicians about an exchange he had with rioters who had fully bought into Mr Trump’s false claims that the election was stolen and believed “nobody voted for Joe Biden”.

In his testimony before Congress in 2021, Mr Dunn, who is black, described how rioters yelled racial slurs at him after he told them that he voted for Mr Biden and his vote should be counted.

Mr Dunn said a crowd of Capitol intruders yelled a racial slur at him, something that never happened while he was on duty during more than a dozen years on the force.