MANILA, Philippines — Nine prisoners were killed when rival gangs clashed with knives Friday in one of the Philippines' most overcrowded prisons, officials said.

It was not immediately clear what set off the violence between the Sputnik and Commando gangs before dawn at New Bilibid Prison in metropolitan Manila.

Seven other inmates were wounded in the clash, Bureau of Corrections spokesman Gabriel Chaclag said. He said an investigation was underway and those who were involved in the fighting would be punished.

The Philippines has some of the world's most notoriously overcrowded jails. A Philippine president once said that imprisonment in the squalor and violence of the country's prisons was worse than death.

In 2005, 27 inmates, including detained Muslim militants from the brutal Abu Sayyaf group, and a police officer were killed when police commandos quelled a jail uprising in metropolitan Manila. Ten inmates, including two Chinese drug suspects, were killed in a 2016 grenade explosion in a jail in Paranaque city in the capital region.