Pope Francis arrives in the country today and will visit a once-notorious prison on Wednesday

A prison riot in the northern Mexican city of Monterrey has claimed 52 lives, just one day before Pope Francis was due to visit the country.

Regional governor Jaime Rodriguez Calderon confirmed the death toll at the Topo Chico prison yesterday and attributed the bloodshed to a clash between two gangs, the Gulf Cartel and Los Zetas. The criminal groups, which were once partners, have fought for control of crime and smuggling territories in Mexico’s troubled northeastern states.

Pope Francis will arrive in Mexico City today for a six-day trip to a country which is riven with insecurity, corruption and violence.

His agenda includes a visit on Wednesday to the once-notorious Cereso prison in the border city of Ciudad Juarez.

State officials say the Ciudad Juarez prison has improved in recent years, with gangs no longer ordering crimes in the city from behind bars, though priests working in the diocesan prison ministry and with the families of inmates say problems persist such as inmates having to pay for protection and privileges.

Fr Oscar Enriquez, director of the Paso del Norte Human Rights Center in Ciudad Juarez, who works with families of the prisoners, said: “There’s a certain control by groups inside the prison. This has not completely been eradicated.”

A 2014 report on correctional facilities from the National Human Rights Commission found widespread problems persisting in Mexican prisons such as overcrowding, self-rule and inmates awaiting trial being locked up with those already sentenced.

“Topo Chico had an occupancy rate of 156 per cent” in 2013, said Jorge Kawas, security researcher and analyst in Monterrey. “Like most local prisons, it is also underfunded and pretty much ungovernable.”

Fr Robert Coogan, an American prison chaplain in Saltillo, 30 miles west of Monterrey, said the Topo Chico prison suffered from self-rule.

“They know how to calm the authorities down by doing things that are pleasing to the authorities,” Fr Coogan said, pointing to the way inmate leaders will keep prisons with self-rule clean, maintained and orderly as a way to keep wardens on their side.

“The reason for [inmates] controlling the prison is that you cannot have an escape every time someone comes in. But sometimes they will use their manipulation … to get the people they want to release all in one place. Once they get them in one place, then they’ll set them free.”