The city centre had been in lock down with luxury shops along the main streets barricaded. Germany’s president condemned the unrest. “The pictures I have seen are shocking and they make me speechless, but they all the more are a reason to be here and to thank those who stood up to this violence,” Frank-Walter Steinmeier said.

Hundreds of hooded anti-capitalist militants had scuffled with police on the fringes of a largely peaceful march on Saturday, after two days of violent clashes which marred the G20 summit.

But late in the evening, after leaders had left Hamburg, police turned on water cannon to disperse remaining protestors, many drunk, who started throwing bottles and other objects. Emergency services said they were treating injured people but gave no numbers.

More than 50,000 people gathered for a “G20 – not welcome” demonstration in the port city in the afternoon. At one point a group of about 120 people, some masked, kicked police and attacked them with flagpoles before running away.

Chancellor Angela Merkel, facing an election in September, had sought to underscore her commitment to free speech by holding the summit in central Hamburg, a trading hub with a long tradition of leftist radicalism.

Images of smoke rising over parts of the city, burning cars, wrecked shops and streets awash with debris have, however, raised questions about her strategy, and police reinforcements from across Germany had to be dispatched to help.

Merkel, who met police and security force after the summit to thank them, condemned the violence but also said the majority were peaceful and legitimate protesters.

“I condemn in the strongest terms the extreme violence and unbridled brutality that police were repeatedly confronted with,” she said at the end of a summit which exposed differences with the United States on climate change.

“There is no justification for plundering, arson and brutal attacks on the lives of police officers … anyone who acts in this way .. places himself outside our democratic community.”

The head of Hamburg police earlier expressed shock at the “wave of destructive anger”, rioting and arson since Thursday.

However, on Saturday mostly young protestors, some holding balloons, others pushing prams, wanted to keep the demonstration peaceful as hip-hop and Turkish music blasted out of speakers.

“The message is G20 – never again and certainly not in Hamburg,” Oskar Zach, 16, told Reuters. “We aim to remain peaceful. We want to show we can demonstrate without violence.”

ATTAC coordinator Thomas Eberhardt-Koester said the movement wanted to “bring our criticism of the G20 and our alternatives for fair global policies onto the streets”.

In the last three days, more than 200 police officers have been injured. Some 143 people have been arrested and 122 taken into custody.

On Friday night, special armed police were deployed with assault rifles after militants, described as the Black Bloc because of their trademark black hoods and masks, hurled objects, including paving slabs, and set barricades alight.

Ministers decried the violent protestors and said they would face the full force of the law. “These are not demonstrators, they are criminals,” said Interior Minister Thomas de Maiziere.

Merkel defended her choice of Hamburg, saying similar summits had been held in big cities such as London and it was unacceptable to say some places were ruled out as venues.