"We neutralized alleged terrorists who tried to take over the facilities of a hospital in Yaguachi, Guayas," the police on X announce.
Those arrested are believed to have tried to free a person who was being treated at the hospital, according to the police.
Firearms and narcotics were seized in the operation.
Police also raided a gang-run medical facility, which also housed a command center and a brothel, where several suspected gang members were hiding.
Ecuador has found itself in a severe and violent crisis caused by the increasing activities and violent methods of drug cartels.
A wave of violence has been sweeping the country since its most notorious cartel boss, Adolfo "Fito" Macías, escaped from a high-security prison earlier this year, prompting President Daniel Noboa to task the military with cracking down on the criminal gangs.