Another 13 prisoners were wounded in the brawl in the penitentiary in the Gulf Coast city of Altamira, Tamaulipas state’s Public Safety Department said in a statement.
The fight started when a group of inmates burst into a section of the prison they were banned from and attacked the prisoners housed there, the department said.
Local media said the fight was between members of the rival Gulf and Zetas drug cartels but authorities wouldn’t confirm the reports. Tamaulipas state has been the scene of bloody turf battles between the two former allies.
Tamaulipas state officials said many of the dead were killed by makeshift knives. A state official who spoke on condition of anonymity because of the ongoing investigation said several of the inmates were beaten to death with clubs or stones.
Soldier and marines managed to take control of the prison, the official said.
The safety department said 22 of the inmates killed were serving sentences for state crimes and nine for federal offenses. It gave no other details.