At least 37 people were killed during clashes between armed inmates and security forces at a small prison in southern Venezuela, the state's governor said Wednesday.

Gov. Liborio Guarulla said the bloodshed came after fighting erupted between inmates and their jailers Tuesday night in the prison in Puerto Ayacucho, capital of sparsely populated Amazonas state.

He said security forces raided the facility seeking to restore order in the prison, where the inmates had seized control several weeks ago.

"At midnight special forces showed up and through the night we heard gunfire and explosions," Guarulla told The Associated Press.

The office of Venezuela's chief prosecutor said on social media that it was investigating the incident. It said 14 prison guards were also injured.

Guarulla said the city's morgue had been overwhelmed trying to handle so many bodies.

Venezuela has around 30 prisons, many of which suffer from overcrowding and are dominated by criminal gangs that traffic in weapons and narcotics as well as plot crimes taking beyond prison walls. The prison system, built to hold about 16,000 inmates, is currently estimated to house some 50,000 prisoners, according to the Venezuelan Prisons Observatory, which monitors prison conditions.

But Guarulla said the facility in Puerto Ayacucho housed only about 110 inmates, all of them awaiting trial, and unlikely suffered from the same volatile conditions seen elsewhere in the country's prisons.

The death toll was the worst in Venezuela since a prison riot in 2013 that left 61 people dead.