Protesters demonstrating in support of teachers receiving better pay in the Brazilian cities of Rio de Janeiro and Sao Paulo have clashed with police.
The centre of Rio was packed with more than 10,000 people marching peacefully.
But as it got dark, some protesters threw firebombs at public buildings and riot police responded with tear gas.
A similar protest in Sao Paulo also ended in violent confrontation with police after many banks were ransacked by hooded protesters.
Brazil's security situation is a challenge to cities that will play host to the 2014 World Cup and 2016 Olympic Games.
The latest demonstration took place over several hours and was peaceful at first.
But once night fell, violent incidents broke out as at least 20 "black bloc" anarchists smashed a City Hall gate while others broke into banks and tried to break break into ATMs. Some banks were set alight.
Demonstrators also torched a bus on busy Rio Branco Avenue, and took furniture out of banks to use in barricades as the stand-off off with police continued.
Authorities used tear gas to restore order.
"Without the police, there is no violence. When they are there, there always is," said anarchist Hugo Cryois, 23, who had a gas mask dangling from his neck.
"I came prepared," he said. "You can't trust them."
Teachers have been demanding a pay increase for two months. About 50,000 people were estimated to have marched to support them before the violence broke out, but police would only confirm the 10,000 estimate.