A battle between gangs in a jail has killed at least 116 people and injured 80 in what authorities are calling the worst prison massacre in Ecuador's history.

President Guillermo Lasso decreed a state of emergency in the country's prison system, allowing the government to deploy the police and soldiers to jails among other powers.

Authorities attributed Tuesday's bloodshed at the Litoral penitentiary in the coastal city of Guayaquil to gangs linked to international drug cartels fighting for control of the site.

Mr Lasso, visibly affected, said at a news conference that what was happening in the Guayaquil prison was "bad and sad" and he could not for the moment guarantee that authorities had regained control of the jail.

"It is regrettable that the prisons are being turned into territories for power disputes by criminal gangs," he said, adding that he would act with "absolute firmness" to regain control of the Litoral prison and prevent the violence from spreading.

Images circulating on social media showed dozens of bodies in the prison's Pavilions 9 and 10 and scenes that looked like battlefields.

The fighting was with firearms, knives and bombs, officials said.