Ecuadorean President Rafael Correa has vowed to punish those he accuses of trying to overthrow the government.
The 47-year-old leftist leader was rescued from protesting police during a military raid.
He was attacked by officers demonstrating against cuts to their bonuses and frozen promotions when he tried to talk to them on Thursday.
The president had to be shepherded away after tear gas was fired in a crowd, leaving him temporarily injured.
Troops then returned him to his palace after hospital treatment.
Two policemen died in the violent end to the stand-off that has shaken the South American nation and brought a terrent of international condemnation from the White House to Havana.
Sitting in the yellow room of the national palace, Correa made a public address and said of the protestors: "These people made the institution look so bad that they attacked their co-citizens, that they abused the weapons given to them by the society to which they belong, that they dishonoured the police uniform."
Of the violence he said: "Don't be fooled: this was a failed attempt at a coup and what they accomplished was that we come out stronger, more determined and more united than ever. We will overcome comrade."
The local Red Cross said two police died as troops stormed the building. At least 88 people were injured throughout the unrest.