At least 31 inmates have been found dead in a prison in southern Ecuador, including 27 who had been hanged, officials say.

Four prisoners were killed and more than 30 injured in clashes between rival gang members in El Oro prison in the city of Machala in the early hours on Sunday.

Hours later, security guards, alerted to a fresh outbreak of gang violence, discovered additional inmates hanged on the building's third floor, according to Ecuador's prison service.

The country's overcrowded prisons have been the site of numerous deadly riots and gang fights that have resulted in hundreds of inmate deaths in recent years.

According to Ecuador's prison service, known by its initials Snai, the clashes were triggered by plans to move some of the inmates to a newly-built prison.

El Oro prison previously experienced another violent incident in September when 13 inmates and a guard were killed in gang clashes.

Relatives of the prisoners have urged authorities to enhance security within the prison, including measures to separate rival gangs, while residents of Machala have long called for the facility, located in the city center, to be relocated.

Earlier this year, the government of President Daniel Noboa announced the construction of a new maximum-security jail in the province of Santa Elena, named El Encuentro, expected to open in late November with advanced security measures.

Prison gangs have significantly contributed to the rise of violent crime in Ecuador, with two such groups, Los Lobos and Los Choneros, being designated as Foreign Terrorist Organizations by the US Department of State in September.