Latin America's largest city, São Paulo, was once among the region's most violent. But the bustling metropolis of over 12 million Paulistanos has experienced a remarkable decline in homicide. The murder rate dropped from a high of 52.5 per 100,000 in 1999 to just 6.1 per 100,000 today. The current rate is almost five times lower than the national average. What's more, most forms of crime declined, albeit more modestly, over the same period.

So what happened?

There are many competing explanations for why São Paulo registered such monumental improvements in safety. For example, some social scientists believe that the murder drop coincides with a decline in the number of young men and falling unemployment. Others say it has more to do with tighter controls on access to alcohol and firearms. A few researchers believe the drop is due to the dominance of a single gang – the PCC – that imposed its own brand of criminal order, a kind of Pax Mafiosa.

Whatever the explanation, the city’s great crime drop does not receive much international attention.

The most convincing analyses attributes São Paulo's homicide decline to changes in law enforcement practices together with strict controls on firearms. The trigger for police reform came, as is so tragically often the case in Brazil, from a crisis. In 1997, the so-called “navy shantytown” incident revealed how state police extorted and tortured residents in a São Paulo municipality called Diadema. The events were broadcast on national television, generating outrage across the country.

Faced with mounting public pressure and protest, state authorities launched a wave of reforms in the late 1990s, beginning with the replacement of the commander of the military police. Innovations included the deployment of community police units working in "hot spot" areas, new guidelines on the proper use of force, data-driven crime mapping tools (called Infocrim), rewards for good performance, human rights and technical training, improvements in investigations, and better coordination between military and civil police forces.

The news is not all positive. Indeed, São Paulo’s police are still involved in the killing of civilians at more than twice the rate of the national average. In 2015, they were responsible for one in four homicides in the state. The involvement of law enforcement in so-called “police intervention” deaths has a corrosive effect on public security. This explains the emphasis of São Paulo's public authorities not just on police oversight and training, but on changing the culture of what it means to be a police officer.

Reforming the police is a necessary, but likely insufficient strategy to improving urban safety. One ground-breaking programme launched in Diadema is also credited with delivering positive results. After demonstrating the links between victimization and areas where bars were clustered, local authorities introduced the “Bar Closing Law” (Lei de Fechamento de Bares) in 2002. Municipal authorities introduced strict controls on alcohol sales after 11pm and installed monitoring systems to track alcohol vendors. They also invested in public lighting and security cameras, as well as changes in the routine of the city's municipal guards.

The results of the pilot projects in Diadema were startling. In 1997, Diadema registered a homicide rate of 140 per 100,000 in 1997, one of the highest in Brazil. By 2008, the homicide rate dropped to 21.1 per 100,000 and today hovers at 22.8 per 100,000. While crime rates are still intolerably high, they are a far cry from the 1990s. Key to the programme's early success was political leadership, public outreach and strong community buy-in, sustained engagement to alcohol retailers, diligent enforcement of the rules, and penalties for non-compliance.

The security situation in São Paulo is far from perfect - but a combination of policing and social innovation have made a remarkable difference. Cities across Latin America would do well to take note.