Brazilian protesters and police have clashed near a stadium hosting a Confederations Cup soccer match, with police using tear gas and rubber coated steel bullets to disperse thousands of demonstrators.

Anti-government protesters, angered by the billions spent in World Cup preparations, picked up tear gas canisters and threw them back at police, along with rocks.

The protesters were about 2 kilometres away from the stadium where Brazil was playing against Uruguay in a semifinal match on Wednesday of the warm-up tournament for next year's World Cup. A banner hung from a bridge read "FIFA go home" in reference to the world soccer body.

Police set up a 2-kilometre perimeter around the stadium, normal procedure for international tournaments. Mounted police and riot units maintained another security line about 1 kilometre from the stadium. About 5,000 policemen deployed to the stadium, with an additional 1,500 army personnel stationed at points throughout the city, sources told Al Jazeera's Gabriel Elizondo in Brasilia.

A further 150 officers have been stationed outside the Brazilian team's hotel, our correspondent said.

"The protesters started this when they tried to break through our outer barrier, we had no choice but to respond" said police Captain Flavio Almeida.

FIFA cancelled a "Soccer for Hope" charity event due to be held in Belo Horizonte on Wednesday, and postponed its chief Sepp Blatter's trip to the city.

By the time the match ended in a 2-1 Brazil victory, most of the protesters had dispersed. In another area of Belo Horizonte, a group of masked young men shattered the windows of car showroom and set the shop on fire.

About 50,000 protesters had earlier massed in a central plaza in Belo Horizonte. "We don't need the World Cup, we need education, we need better health services, a more humane police" said Leonardo Fabri, a 19-year-old protester.

And security has been stepped up in Rio De Janeiro, after eight civillians and one policeman were killed in police action against gang members in a favela on Tuesday.

It's the latest protest to turn violent as Latin America's biggest country has been experiencing nationwide protests since June 17.

Elsewhere in Brazil the situation was mostly calm, in part because Brazil's congress shelved legislation that would have limited the power of federal prosecutors to investigate crimes such as political corruption. It was a target of nationwide protests. Peaceful protests were seen in Brasilia and the northeastern city of Recife.

Public services

The wave of protests in Brazil began as opposition to transportation fare hikes, then expanded to a list of causes including high taxes, poor services and high World Cup spending.

It has become the largest eruption of public demonstrations Brazil has seen in two decades.

Many Brazilians believe that the huge cost of staging the Confederations Cup and the 2014 World Cup is to the detriment of public investment in health, transport and education.

President Dilma Rousseff last week proposed a popular referendum on sweeping political reforms, a $25bn investment in public transport and allocation of more resources for education, health and social services.

In an emergency meeting with Brazil's governors on Monday, Rousseff proposed a national plebiscite to ask voters whether they agree to holding a constituent assembly to reform Brazil's political system.

Legal experts said that was unconstitutional.