Rio de Janeiro has named its first female police chief after a purge of the city’s civil force revealed widespread corruption, as the struggle continues to pacify the favelas before the World Cup in 2014 and the Olympic Games in 2016.

Only days after the February 11 arrest of 30 Rio police officers in a sweeping anti-corruption operation, the police chief himself was dismissed over accusations that he leaked information about the investigation to one of the officers who was detained. He has been replaced by Martha Rocha, who promises a crackdown on corruption, in a move which could signal real progress in cleaning up the institution.

Rio’s police force is one of the most corrupt and brutal in the world, according to Human Rights Watch, which warned in 2009 that police in Brazil’s second city routinely carry out extrajudical executions, and that officers are often members of illegal armed militias. The NGO said in their report that Rio de Janeiro state police killed some 1,137 people in 2008, and that “impunity is the norm” for officers who commit crimes.

This high level of corruption and violence is holding back Brazil’s work to stem violence and take its place on the world stage as a developed nation. With the 2014 World Cup and the 2016 Summer Olympics approaching, the country is keen to restore order to its crime-infested cities.

In 2008 the government launched a drive to take control of Rio’s lawless favelas, shanty-town areas where government presence is minimal at best. Specially-established “Pacifying Police Units” (Unidades de Polcia Pacificadora – UPPs) have been sent into city’s slums to seize control from the gangs, and are intended to be a long-term presence to consolidate state control in these areas.

The favelas are controlled by drug gangs who provide security and dispense “justice” using their own private armies, with police only visiting to make raids. Estimates vary on the number of people living in Rio’s slums, but New Yorker magazine said in 2009 that the city had more than 1,000 favelas, inhabited by three million of the city’s fourteen million inhabitants. This population has soared in recent decades, with an influx of impoverished people from the countryside pouring into the cities and occupying whatever land they could.

InSight has reported on the limitations of these pacification operations, which have met with a certain success in the areas they have been carried out in so far, but which may be merely pushing gangs out of one favela and into another. Despite managing to take over many slums with little resistance, there have been serious incidents demonstrating the continuing power of criminal groups. Gangs in one slum managed to shoot down a police helicopter in October 2009, and there remain large areas of the city that have not yet been touched by the UPP forces and where gangs may be regrouping.

An important factor limiting the success of these operations is the deep unpopularity of the police. The second phase of the pacification plan, after the military take-over of the favelas, is for police units to occupy the area to win “hearts and minds,” imposing and maintaining order. Previous operations to clean up the slums have failed to do this in any lasting way and the gangs have simply ceded territory, returning as soon as the security forces have left. This occupation stage could last for up to 25 years, by some estimates.

This crucial long-term element of the plan will only work if police win the trust of the local populations. In November 2010 police engaged in a five-day battle to take part of Complexo do Alemao, a group of favelas, leaving 37 dead. The fact that this area was the site of an infamous 2007 massacre of civilians by the police is unlikely to help with the task of winning over residents and imposing the rule of law.

Human Rights Watch has called for police reform, saying that “The residents of Rio and São Paulo need more effective policing, not more violence from the police.” There are now moves to make this a reality; as well as the recent anti-corruption swoop, in December Rio de Janeiro state authorities proposed a plan to reward those police officers who commit fewer acts of violence, by raising their salaries. This could have a dramatic impact on corruption — a 2008 UN report highlighted low police salaries in Rio as a key factor in encouraging police to extort citizens and join militia groups.

The confidence-building efforts by the UPPs are apparently having results. A representative of Rochinha, Rio’s biggest favela, told CNN in November 2010 that “our population feels more protected and respected by the police with the creation of these … peace units.”

The approach has echoes of other moves to fight crime in the region; Rio state governor Sergio Cabral reportedly drew inspiration from the Colombian city of Medellin, where security forces have fought a long battle to clear gang-controlled slum areas. Resurgent levels of crime in the last three years have demonstrated the difficulties of a purely military approach to the problem, and suggest that Brazil’s trust-building program is a step in the right direction.