Brazil's army has completed its withdrawal from several Rio de Janeiro slums occupied in late 2010 as part of a large-scale operation against drug traffickers, handing peacekeeping duties over to police, officials said.

The soldiers pulled out early Thursday from the Vila Cruzeiro shantytown, or "favela," and other slums in the Penha district of northern Rio and were replaced by nearly 500 officers from an elite unit of the Rio de Janeiro State Military Police.

Those officers will take over the task of tracking down drug traffickers in that part of the metropolis and pave the way for the installation of elite police pacification units, or UPPs, the Military Police said in a statement.

The withdrawal of the soldiers began in March at shantytowns in the adjacent Alemao district, where six UPPs have been inaugurated.

Alemao and Penha had been the main stronghold of the Red Command gang, which had controlled those areas for decades.

The authorities expelled the drug traffickers in an unprecedented joint police-military operation in November 2010, a crackdown that followed a week of violence in which criminals carried out armed attacks and set vehicles on fire.

No one was wounded in the tank-backed occupation of the Alemao district because the drug gang members fled through the sewer system, but police operations carried out in previous days in other shantytowns controlled by the Red Command had left 36 dead.

Since late 2008, the Rio de Janeiro state government has sought to remove drug dealers from dozens of favelas and then insert UPPs to provide a permanent community police presence, improve infrastructure and provide health and social services.

The state government is trying to pacify Rio city's most violent favelas in preparation for hosting the 2016 Olympics. EFE