Rio de Janeiro was once again racked by violent protest on Tuesday night as a teachers strike became the latest rallying point for public discontent over public services and police brutality.
Several tens of thousands joined a demonstration in support of teachers, who are opposed to a salary and benefit package proposed by Rio's mayor, Eduardo Paes.
The turnout, despite a torrential downpour, was among the biggest since a nationwide wave of protests in June that overshadowed preparations for next year's World Cup.
Anarchist groups smashed banks and burnt a bus, while "Black Block" protesters threw firebombs at the police, who responded with teargas, rubber bullets and percussion grenades.
The scenes outside the city hall will resurrect fears about social stability that had abated in recent months. After the million-strong protests three months ago, the president, Dilma Rousseff, tried to assuage public anger with a promise to divert more revenue to education and health.
But scepticism remains. Brazil spends a similar amount of its GDP on education as the UK, but the returns on this public investment are poor. With short school hours, high truancy rates and comparatively poor academic results, many suspect the system is mired in corruption and excessive bureaucracy.
In Rio, the teachers' union says the mayor's pay offer is too low. Many feel that the public education system is failing the nation and needs major reform. They have been on strike for 46 days.
Among the protesters was Gisela Ferreira, who earns 1,000 reais (£280) for a 64-hour month of teaching in a secondary school in Paraty. She said she joined the demonstration because the education system in Rio was being privatised by stealth.
While contracts were extended to private companies for classroom air conditioner rentals and other basic services, she said, there was less money for teachers, some of whom were expected to teach more than 10 subjects. "I've been a teacher for six years and in that time, conditions have got worse and worse. Every year we have less autonomy."
At the beginning the demonstration was colourful and largely peaceful. One group calling itself the Tropa de Prof (Teachers' Troop) played music and danced in bright red and green carnival wigs.
"We want to show our solidarity with the teachers," said Isabel Mansur. "Their conditions are terrible. And when they protested last week, there was an unacceptably violent response from the police."
Many on the march wore crash helmets and masks in preparation for conflict with the police. Black Bloc protesters carried banners depicting molotov cocktails and slogans reading "The people's rebellion is justified". They handed out leaflets outlining their position, which said: "Relax people. It's us, the Black Bloc. What you can't do, we can. We don't just attack, we defend people against police abuse and defend our right to protest."
When crowds gathered outside the city council building amid a downpour, the sporadic clashes intensified. One group of Black Bloc anarchists smashed a gate to the city hall, while others broke into shops and set fire to banks and buses. Police fired volleys of teargas and percussion grenades to disperse the crowds, who responded with firebombs.
Another teacher at the protest, Aline de Luca, said that despite the violence of last week's demonstration, she had come back because the education system needed to be changed.
"I want our classes to be better resourced. At present we can't function properly as a school because there is no money even for a janitor or a secretary," she said.
She was heartened by the increased turnout. "We have support from the people. Many of those who are here are not education professionals", she said. "I am hopeful things will improve because we have never seen society as mobilised as it is now."
Additional reporting by Anna Kaiser