QUITO, Ecuador (AP) -- Ecuador's president has declared a state of emergency in the prison system following a battle among gang members in a coastal lockup that killed at least 118 people and injured 79 in what authorities say was the worst prison bloodbath ever in the country.
Officials said at least five of the dead were found to have been beheaded.
Dozens of police and military vehicles, as well as ambulances, entered the prison compound on Thursday. Helicopters flew over the area.
There could be more bodies or seriously injured people in the prison, said Col. Tannya Varela, the national police commander.
Hundreds of people gathered outside the crime lab in Guayaquil, hoping to collect the bodies of relatives they believed were killed in the prison. The prosecutors' office said on Twitter that police were working to identify bodies.
Henry Coral, a police official, asked family members to help speed the identification of bodies by telling authorities about any tattoo, scar or other distinguishing feature of prisoners believed to have been killed. Some bodies were mutilated or burned, making identification harder.
President Guillermo Lasso decreed a state of emergency Wednesday, which will give the government powers that include deploying police and soldiers inside prisons. The order came a day after bloodshed at the Litoral penitentiary in Guayaquil that officials blamed on gangs linked to international drug cartels fighting for control of the facility.
"It is regrettable that the prisons are being turned into territories for power disputes by criminal gangs," Lasso said, adding that he would act with "absolute firmness" to regain control of the Litoral prison and prevent the violence from spreading to other penitentiaries.
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. Earlier, regional police commander Fausto Buenano had said that bodies were being found in the prison's pipelines.
Outside the prison morgue, the relatives of inmates wept, with some describing to reporters the cruelty with which their loved ones were decapitated and dismembered.
"In the history of the country, there has not been an incident similar or close to this one," said Ledy Zuniga, the former president of Ecuador's National Rehabilitation Council.
Zuniga, who was also the country's minister of justice in 2016, said she regretted that steps had not been taken to prevent another massacre following deadly prison riots last February.
Earlier, officials said the violence erupted from a dispute between the "Los Lobos" and "Los Choneros" prison gangs.
Col. Mario Pazmino, the former director of Ecuador's military intelligence, said the bloody fighting shows that "transnational organized crime has permeated the structure" of Ecuador's prisons, adding that Mexico's Sinaloa and Jalisco New Generation cartels operate through local gangs.
"They want to sow fear," he told The Associated Press on Wednesday, urging the government to temporarily cede control of the prisons to the National Police. "The more radical and violent the way they murder," the more they achieve their goal of control, he added.
Luis Hernandez, an analyst on political and military affairs who was a general in Ecuador's army, said imprisoned gang members extend their control from prisons to the streets, managing debts, deliveries and other aspects of the illegal drug trade.
Ecuador is a key transit point for drug trafficking organizations because of its good road infrastructure, three international maritime ports and two international airports, Hernandez said.
Ecuador's president said that care points had been set up for relatives of the inmates with food and psychological support. He added that a program to address the country's prisons will be accelerated, starting with investments in infrastructure and technology in the Litoral prison.
The former director of Ecuador's prison bureau, Fausto Cobo, said that inside penitentiaries authorities face a "threat with power equal to or greater than the state itself." He said that while security forces must enter prisons with shields and unarmed, they are met by inmates with high-caliber weapons.
In July, the president decreed another state of emergency in Ecuador's prison system following several violent episodes that resulted in more than 100 inmates being killed. Those deaths occurred in various prisons and not in a single facility like Tuesday's massacre.
Previously, the bloodiest day occurred in February, when 79 prisoners died in simultaneous riots in three prisons in the country. In July, 22 more prisoners lost their lives in the Litoral penitentiary, while in September a penitentiary center was attacked by drones leaving no fatalities.