Thousands of anti-lockdown demonstrators defied a court-ordered protest ban on Sunday and gathered in the streets of Berlin, resulting in scuffles with police.

Police said some protesters had "harassed and attacked" officers and ignored roadblocks, disrupting traffic in parts of the German capital.

"They tried to break through the police chain and pull out our colleagues. This led to the use of irritants, batons and physical violence," Berlin police tweeted.

A police spokesman said some 5,000 protesters had turned out. More than 600 were detained.

The protest was called by the "Querdenker" (Lateral Thinkers) movement, which has emerged as the loudest voice against Germany's coronavirus restrictions.

Judges had banned several of its planned demos this weekend, including one for Sunday that was expected to draw some 22,500 people.

The court said it could not allow the rallies to go ahead over fears that participants would flout rules on mask wearing and social distancing, at a time when Germany's infection numbers are on the rise again.

'No to the corona dictatorship': Thousands stage anti-lockdown protest in Berlin
'No to the corona dictatorship': Thousands stage anti-lockdown protest in Berlin AFP / Paul ZINKEN

Berlin police deployed more than 2,000 officers in riot gear across the city, in anticipation of protesters ignoring the ban.

Most of the demonstrators gathered in Berlin's western Charlottenburg district and in the city centre.

Demonstrators held up signs saying "Freedom" and "No to the corona dictatorship", with few masks seen among them.

At one point, officers threatened to use water cannon to break up crowds heading towards the Brandenburg Gate, after which people began to clear the area.

By late evening, police said the last groups had dispersed.

Germany's Querdenker movement has drawn in a mix of people, including critics of coronavirus vaccines, pandemic conspiracy theorists, and members of the far-right Alternative for Germany (AfD) party.

Querdenker protests have at times attracted huge numbers but are often broken up early for violating virus rules. Several of the demos have descended into violence.

Germany's domestic intelligence service announced in April that it was placing some Querdenker members under observation over concerns they have ties to right-wing extremism.