A battle between the feared Zetas drug cartel and rivals at a prison has left 49 people dead in the northeastern Mexican city of Monterrey, authorities say.
It comes just days ahead of a planned visit by Pope Francis to another jail in Mexico's far north.
The incident was one of the worst in a series of deadly riots in recent years to rock the country's overpopulated prisons, some of which are largely controlled by cartels.
Fighting broke out before midnight in two areas of the Topo Chico prison between supporters of a gang leader known as "Zeta 27" and another group, with prisoners using bottles and blades, Nuevo Leon state Governor Jaime Rodriguez said.
"Topo Chico is a ... very old prison. A prison with very difficult security conditions," said Rodriguez, who described the state's prison system as a "time bomb" that needed to be defused.
A 2014 human rights report faulted Topo Chico for not preventing violent incidents. The prison has long housed members of the Zetas, known for extreme violence. One Zetas leader was stabbed to death there in September.
Authorities revised down their initial death toll from 52, out of a total of about 3500 prisoners.
One victim died from gunfire, while the rest were killed from a combination of knives and other objects like bottles and chairs. Flames licked the night sky after inmates set light to food storage areas.
Milenio TV reported that inmates' relatives who had been within the prison's premises for conjugal visits had seen inmates with burns. Twelve people were injured, five seriously, the state government said.
Speaking to local radio, Rodriguez acknowledged the public perception that the Zetas dominated the facility and said the prison system was one of his principal concerns.
"The problem is they have people like my brother living with narcos," said an angry relative of an inmate doing time for robbery, waiting for names of the victims at the prison gates.
Rodriguez said 40 victims had been identified so far. The names of Zeta 27 and a rival known as El Credo were not among a list of 20 names released by state government.
Authorities are transferring inmates out of the prison to bring down the population, with 60 people set to be moved on Thursday (local time).
Pope Francis is set to begin his first visit to Mexico as pontiff on Friday. Next week, he will visit a prison in border city Ciudad Juarez, once one of the world's most violent cities.