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 on Wednesday.

Governor Liborio Guarulla said the bloodshed came after fighting erupted between inmates and their jailers on Tuesday night in the prison in Puerto Ayacucho, the 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.

READ MORE: Malaria infections spreading in crisis-ridden Venezuela

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.

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

Carlos Nieto of the prison-monitoring group "A Window to Freedom" told AFP news agency that it was "the worst riot we've had in a detention facility".

"In this one, detainees are only supposed to be held for up to 48 hours, but there were prisoners who have been there for years," he said.

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

Caracas has also been engulfed by a political crisis, with the opposition accusing President Nicolas Maduro of attempting to establish a dictatorship, while more than 120 people have been killed in anti-government protests.

A newly created constituent assembly established by Maduro immediately declared itself supreme to all other branches of government, including the opposition-controlled National Assembly, shortly after its inauguration this month.

The United States, the European Union and many Latin American states have refused to recognise it.