Thousands of protesters marched through downtown Toronto on Saturday, setting police cars ablaze and smashing store windows in a show of opposition to the G20 summit as police in riot gear scrambled to contain the violence.

Black-clad anarchists separated from what began as a peaceful procession, fanning out through the core of a city generally known for its civility, and forcing police to rush to keep up.

Police cars were set ablaze in at least two areas, including the city's Bay Street financial district, while protesters on trendy Queen Street smashed storefronts and damaged media trucks.

Banks, coffee shops and small stores were also targets and protesters appeared to loot at least one retailer.

Police made more than 30 arrests over the course of the day, and by early evening appeared to be taking more people into custody. Riot police aggressively moved to disperse the remaining protesters clustered at Toronto's Queen's Park.

A Reuters reporter said police were charging the crowd, grabbing individuals, and removing them from the group, while police on horseback moved around the perimeter, herding the group through the park where the protest began about six hours earlier.

Police also fired oversized plastic bullets in the effort to clear the park, the reporter said.

Toronto Mayor David Miller condemned the day's violence, but said it was caused by a small group within the larger protest.

A relatively small group of people ... came clearly with the intent of damaging property and perpetrating violence, Miller said at a news conference. They're criminals that came to Toronto deliberately to break the law.

The initially peaceful march numbered in the thousands when it began in the early afternoon, organized by labor groups that say G20 economic policies favor the rich.

But tensions escalated after the demonstration moved within blocks of the 10-foot (3-meter) security fence that rings the G20 summit site.

Anti-G20 groups have been demonstrating in Toronto leading up to the summit of rich and emerging economies, which follows a smaller meeting of Group of Eight industrial nations in the Ontario resort town of Huntsville.

Canada has budgeted more than C$1 billion ($970 million) for security for the two summits.

(Reporting by Pav Jordan, additional reporting and writing by Cameron French, additional reporting by Claire Sibboney; Editing by Mario Di Simine)