HAMBURG, Germany — Tens of thousands of peaceful protesters took to the streets to demonstrate against the Group of 20 summit in Hamburg on Saturday, hours after masked rioters clashed with police, burned cars and looted businesses.

Marching on a route close to where some of the worst violence unfolded overnight, protesters chanted, sang, danced and played music as world leaders wrapped up their two-day summit in the German port city.

An eclectic crowd of families pushing baby carriages, Kurdish groups, Scottish socialists and anarchists waving flags and shouting anti-capitalist slogans progressed through the city accompanied by thousands of police officers.

Despite the mayhem late Friday and early Saturday, many officers patrolling the march removed their helmets and appeared relaxed as the huge crowds passed by. Organizers said some 78,000 demonstrators participated, while police estimated the crowds at about 50,000.

The big gathering came after aggressive riots overnight in the city’s Schanzenviertel neighborhood, which is only a few hundred yards away from the summit grounds.

About 500 people looted a supermarket in the neighborhood as well as smaller stores.

Cars were torched and street fires lit as activists built barricades with garbage cans and bikes.

German Chancellor Angela Merkel expressed shock and anger about “violence and uninhibited brutality” that broke out in Hamburg.

A few thousand rioters, some of them from elsewhere in Europe, created havoc in the city. They battled riot police for two consecutive days and nights, expressing rage against capitalism and globalization and calling for open borders to let all refugees enter Europe.