* Death toll rises to 46 after 6 days of violence
* Government says soldiers needed to ensure peace in Rio
* Drug traffickers defy police, wave machineguns (Updates death toll and injured)
By Rodrigo Viga Gaier and Sergio Moraes
RIO DE JANEIRO, Nov 26 (Reuters) - Backed by armored personnel carriers and 800 soldiers, police prepared a major offensive on Friday to occupy one of Rio de Janeiro's largest slums where heavily armed drug traffickers bunkered up after days of violence.
Forty-six people have been killed since police first clashed earlier this week with suspected gang members who attacked police stations and burned nearly 100 cars and buses, and the planned advance could push the death toll higher.
Authorities blamed the assaults on orders from imprisoned gang members angry at police efforts to take control of their turf in more than a dozen slums.
The latest wave of violence raises renewed doubts over the city's ability to host the 2014 soccer World Cup and the 2016 Olympics, even though sports authorities have said they trust the government's security measures. [ID:nLDE6AP199]
Pedestrians applauded as the military convoy rattled through city streets on the way to the Alemao favela, or shantytown, where traffickers took shelter after fleeing from advancing police on Thursday.
Masked men, some dressed in shorts and camouflage T-shirts, defiantly waved their machineguns in the air. Others pointed their guns down the winding roads of the hilly slum, apparently on watch for advancing police officers.
Some of them fired shots at a police helicopter patrolling the area, according to a Reuters witness.
"We'll invade Alemao at the right moment. We're depending on information from intelligence services," said Roberto Sa, Rio de Janeiro state's under-secretary of public security.
Fighting in the area on Friday killed at least three people and injured 10. A Reuters photographer was shot in the shoulder by a bullet outside of the Alemao favela. He was being treated in a local hospital. His injury was not life-threatening.
Elsewhere, residents have also had to take cover from gunfire and skirt burning buses on their way to work.
The government defended the unusual deployment of army soldiers, saying they would primarily provide backup and logistic support to free police officers to engage the gangs.
"The confrontation is necessary so we can have a state in peace," Defense Minister Nelson Jobim told a news conference.
The use of the armed forces to quell urban violence remains controversial in Brazil, where the military fought and tortured political dissidents during its 1964-1985 rule.
Human rights groups regularly accuse police of using excessive force.
Still, most residents appear to back Rio de Janeiro Governor Sergio Cabral's hard line on crime.
Cabral stressed his government did not rely only on force to quell violence but had invested billions of reais to improve the quality of life in Rio de Janeiro's impoverished slums.
Opinion polls show that public security is one of the top issues President-elect Dilma Rousseff will face when she takes office on Jan. 1. (Additional reporting by Pedro Fonseca; writing by Raymond Colitt; editing by Anthony Boadle)
Our Standards: The Thomson Reuters Trust Principles.