The early morning rush hour often slows traffic to a snail pace in this sprawling megacity, but on Oct. 19, drivers on one road found themselves at a complete standstill. The holdup was caused by a grizzly discovery: a corpse hanging from a bridge. While such public displays of terror have become frighteningly common in parts of Mexico, the capital has long been considered an oasis from the narco violence. It is home to much of the nation’s political and business elite, a third of all foreigners in Mexico, including many Americans, and offices of major corporations. Photos of the dangling corpse on front pages raised alarm bells that the bubble of relative safety could have burst.

Fears were compounded in the following days when more corpses appeared alongside threatening messages, which are another terror tactic of Mexico’s mafias. Under public pressure, thousands of police hit the streets, arresting a 600 suspects. Among the suspects, prosecutors announced, was an alleged assassin involved in hanging the body. “We won’t tolerate impunity or any intimidation against the residents of Mexico City,” the city’s top prosecutor Rodolfo Rios told a news conference. Evidence gathered, he said, indicated that the murders are linked to gangs inside Mexico City’s crowded jails.

An unidentified dead man hangs from his waist under an overpass in the southern part of Mexico City, on Oct. 19, 2015. Jair Cabrera—AP

Mexico City has long been saved from cartel violence as it is not a turf that drug traffickers want to fight over. Most narco bloodshed is in the mountainous states where cartels grow opium and marijuana, such as Sinaloa, Michoacan and Guerrero, or along the 2,000-mile border with the United States, where traffickers smuggle their products to American users. When drug traffickers have surfaced here, it is often hiding out in exclusive apartments or luxury mansions, such as one that police raided to find a private zoo of lions, tigers and panthers. If cartel bosses run into each other in these exclusive neighborhoods, they often hold back from fighting, in what appears to be a kind of “pax mafiosa.”

However, the prison system has opened up a new front of violence here. During a decade of intense cartel fighting in Mexico, the security forces have arrested tens of thousands of their alleged operatives, including many sicario hit men. With prisons crowded across the county, many have ended up in jails in the capital.

The Federal District, which includes the central part of Mexico City, is home to just 8% of Mexico’s population, but houses almost a fifth of the nation’s prisoners. About 3,500 of the 37,000 inmates in the area are on federal charges, including drug trafficking and organized crime, says Hazael Ruiz, the under secretary for the penitentiary system in Mexico City. “We have a very big prison population. We have federal inmates who have a different profile and pose bigger risks,” Ruiz tells Time, in an interview inside the Santa Marta prison. “These are people with high sentences and sometimes we don’t have adequate facilities to imprison them.”

Inside these crowded jails, the prisoners have formed gangs to defend themselves. They fight over the profits of smuggling anything from heroin to cellphones to Viagra into inmates, says Saskia Niño de Rivera, a social worker in Mexican penitentiaries. “You have almost 40,000 prisoners in a small area, which means that you have a series of illegal businesses that together are worth a lot of money, millions of dollars,” De Rivera says. “Right now, you have one group trying to take over this business from another, and that has lead to violence in the prisons and on the streets.”

On one side of this battle, prosecutors point to an inmate known as El Avispa, or the Wasp, a 27-year kidnapper called Paulo Sergio Contreras. Another prisoner shot him six times inside the Santa Marta prison in July, but he survived. Messages by the corpses on Mexico City streets have been signed with “Wasp” at the bottom. On the other side, prosecutors point to a prisoner called Luis Eusebio Duque, also known as “Duke.” The Duke was in prison in the capital but was transferred to the border state of Chihuahua, where he may have forged links with the cartel there.

This latest spat of killings adds to an already bad year for violence in Mexico City. In the first nine months, there were 642 murders inside the Federal District, a 22% increase compared to the same period last year. It was the highest number since 1998. As well as fighting over the prisons, gangs appear to be diversifying into new rackets such as shaking down businesses for protection, even in trendy middle class areas. “Businesses have had to close down because of extortion,” anti crime activist Isabel Miranda de Wallace told a news conference.

Still, Mexico City remains a world away from the most embattled Mexican states. If the same murder rate continues, the Federal District will finish 2015 with about 10 murders for every 100,000 people. Guerrero is set to have six times that rate. Mexico City is also less homicidal then the United States’ most murderous metropolises, such as Detroit which suffered 44 killings for every 100,000 residents last year. The world’s murder capital San Pedro Sula, in Honduras, suffered 171 murders per 100,000.

Despite the upward trend in Mexico City, De Rivera does not believe it will ever become as violent as the grimmest parts of Mexico or Latin America. “There are too many big political and business interests here,” De Rivera says, “The government won’t let it fall apart like some other parts of the country.”

Get The Brief. Sign up to receive the top stories you need to know right now. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Contact us at letters@time.com.