Ecuadoreans have voted against allowing the return of foreign military bases in the country, frustrating US hopes of expanding its presence in the eastern Pacific region.

The referendum result is a blow to Ecuador's President Daniel Noboa, who had campaigned to change the constitution to reverse a ban that the country's legislature passed in 2008.

He had said it would help fight organised crime and reduce the soaring violence the country has seen in recent years, during which it has become one of the world's biggest drug-trafficking hotspots.

The US had hoped the referendum would pave the way to opening a military base in Ecuador, 16 years after it was made to close a site on its Pacific coast.

While Ecuador does not produce cocaine, its huge ports and proximity to Colombia and Peru - where large quantities of the drug are made - make it a desirable and lucrative location for drug-trafficking gangs.

About 70% of the world's cocaine passes through Ecuador, according to Noboa.

His presidency has been defined by a tough military crackdown on criminal gangs, including by putting armed soldiers on the streets. Supporters say his approach has helped to fight crime, but critics say his government has resorted to authoritarian tactics.

The former US military base on Ecuador's Pacific coast was closed after left-wing President Rafael Correa decided not to renew its lease and pushed for the constitutional ban.

On the day of the referendum, the leader of one of Ecuador's biggest drug-trafficking gangs was captured in an operation involving Spanish police. Wilmer Pipo Chavarria had faked his own death and had been hiding in Europe while controlling criminal operations like drug-trafficking, Noboa said.

This referendum came as the US sent its largest military deployment to the Caribbean in decades, including the world's largest warship and bomber planes. It has carried out numerous strikes on alleged drug-trafficking vessels, leading to speculation that the US is looking to strike land targets in Venezuela amidst allegations against its president, Nicolás Maduro.

Noboa reacted to the referendum results by stating he would respect the outcome, indicating a commitment to adhere to the democratic process in Ecuador.