The explosions overnight in the capital - one at a building formerly used by SNAI and another still in use by the agency - caused some exterior damage to the second building and led to six arrests. There were no injuries.

"There are violent actions like that of the two cars burned in Quito last night, clearly that's a reaction to an action. The action of imposing order in the prisons, the reaction to intimidate," Lasso said at a housing event in Los Rios province.

Lasso said on X, the social network previously known as Twitter, that operations in Cotopaxi prison on Wednesday were meant to confiscate arms, munitions and explosives. SNAI did not comment.

Lasso, who called early elections amid an impeachment effort against him, has been heavily criticized for failing to control rising violence on the streets and in prisons that has resulted in a heavy death toll.

The bloodshed was thrown into sharp relief by the early August assassination of anti-corruption presidential candidate Fernando Villavicencio.

Security secretary Wagner Bravo told a local radio station some prison guards and police were being held hostage at Turi prison in Cuenca but did not give further details.

Bravo also said the Quito explosions could be related to prisoner transfers. Transfers of gang leaders have previously caused rioting in Ecuador jails.

Five of those detained in the bombing are Ecuadoreans and one is Colombian, authorities said on X.

(Reporting by Alexandra Valencia; Writing by Julia Symmes Cobb; Editing by David Holmes and Cynthia Osterman)

By Alexandra Valencia