Clashes after teachers protests in Rio and Sao Paulo
Protesters have clashed with the police in Brazil's largest cities, Rio de Janeiro and Sao Paulo, after marches in support of striking teachers.
Soon after a peaceful march by more than 5,000 people ended in Rio, a much smaller masked group attacked shops, set fire to a police car and threw petrol bombs.
There were also clashes in Sao Paulo, where shops were ransacked.
Police responded with tear and pepper gas and detained dozens of people.
Four officers were injured and seven banks were vandalized during the unrest in Sao Paulo, according to Reuters news agency.
As was the case in a larger protest last week, it was in Rio that the demonstration turned particularly violent. Among the several thousand teachers were more militant groups, known as the Black Blocs.
Television pictures showed small groups of masked men dressed head to toe in black attacking banks and lighting fires around the historic city centre. At least one police patrol car was set alight.
Riot police responded with baton charges and tear gas but they were also accused by some protestors of using excessive and indiscriminate force.
The teachers, who want a big increase in their basic salaries and better working conditions, have been told to return to work by the city authorities.
But the continued disorder and violent protests are a huge concern to the Brazilian government with just eight months to go before Brazil hosts the football World Cup.
Extra police had been deployed in Rio de Janeiro for the huge protest coinciding with Teacher's Day, on which the country recognises the profession.
Many shops and banks had boarded up their windows after last week's larger protests, which had gathered more than 10,000 supporters.
Police also cordoned off the Rio house of representatives, which was targeted last week.'Right to strike'
After the end of Tuesday's march, masked protesters from the so-called Black Bloc anarchist group set fire to the boards, as well as public telephones, rubbish bags and other street furniture.
Metal boards were also taken by some groups and used as shields to confront the police.
A police car was set alight and protest slogans written on walls.
Teachers in Rio are demanding better working conditions and salaries and have the support of colleagues in other cities.
They have been on strike for two months and many complained that Rio's state government had started procedures to sanction the striking teachers.
But on Tuesday night, a Supreme Court judge said it considered the government's actions illegal.
Judge Luiz Fux told Brazil's state news agency, Agencia Brasil, that the sanctions infringed, "even if in a roundabout way, the civil servants' right to freedom of expressions through strike".
Mr Fux also summoned union leaders and government officials for talks on 22 October.
In an earlier demonstration on Tuesday, a group of homeless people tried to break into the house of representatives of Sao Paulo.
Police held off the crowd, and a small group later met with government officials.
In the south-eastern city of Belo Horizonte, a peaceful protest was held a central square.
Smaller groups also gathered on Tuesday in Brasilia, the north-eastern city of Salvador and other cities.
Brazil's security situation is a challenge to cities that will play host to the 2014 World Cup and 2016 Olympic Games.