Scores of pro-Palestinian protesters on Wednesday night clashed with police outside the national headquarters of the Democratic Party in a melee that forced a lockdown of nearby offices of the US Congress.

"Our officers are working to keep back approximately 150 people who are illegally and violently protesting" near the party offices, the US Capitol Police said in a post on X, formerly Twitter.

"Officers are making arrests."

Police escorted legislators who were at the Democratic National Committee (DNC) offices at the time out of the building to safety.

The protesters were calling for a ceasefire and an end to military activity by Israel in the Gaza Strip.

Six police officers were treated for injuries "ranging from minor cuts to being pepper sprayed to being punched," Capitol Police posted later in the evening after protesters were cleared out.

"Was just evacuated from the #DNC after pro-terrorist, anti-#Israel protestors grew violent, pepper spraying police officers and attempting to break into the building," California lawmaker Brad Sherman posted on X.

"Thankful to the police officers who stopped them and for helping me and my colleagues get out safely," wrote Sherman, a Democrat.

Another legislator, Sean Casten of Illinois, chided the protesters for "blocking all entries to a building with multiple members of Congress in it," which he said left police dangerously unaware of their intent.

Casten posted on X that he, too, was "rescued by armed officers."

Photos posted on social media showed protesters wearing black T-shirts stenciled with "Cease Fire Now" in white letters scuffling with police officers trying to pull them away from the building's entrance.

Security agents ordered lawmakers and their staff in buildings near the US Capitol, close to the DNC building, to stay inside.

"Significant demonstration activity, no entry or exit is permitted at this time. You may move throughout the buildings," a security alert said.

The violent demonstration came a day after many thousands of people gathered on the National Mall in a pro-Israel rally.