|Correa said those responsible for the uprising would be punished 'without pardon' [Reuters]
Security forces loyal to Ecuador's president have stormed a hospital in the capital, Quito, where Rafael Correa was trapped by police officers protesting over plans to cut their benefits.
Twelve hours after police surrounded the hospital on Thursday, soldiers moved amid heavy gunfire and Correa was rushed out of the building.
Two policemen and a soldier were killed when the army moved in. At least 37 others were injured as Correa supporters skirmished with police outside the hospital.
Addressing supporters after his release, the president said the uprising was not a simple police insurrection over pay-related grievances but an attempt to overthrow him.
"There were lots of infiltrators, dressed as civilian and we know where they were from," he shouted from the balcony of the presidential palace.
Correa said those responsible for the rebellion would be punished.
"There will be no pardon," he said, as celebrating crowds waved flags and cheered.
Freddy Martinez, Ecuador's police chief, who was not involved in Thursday's protests, stepped down after failing to control his force and prevent the incident, Reuters news agency reported, citing a police spokesman.
"Last night he told me he had presented his resignation," the police spokesman said.
Miguel Alvear, a journalist in Quito, told Al Jazeera that, despite uprisings from the police and some in the military, the president appeared to have retained full control of the country.
"He has the support of the armed forces and the attorney-general has already announced that he will investigate and prosecute the people behind this."
Al Jazeera's Monica Villamizar, reporting from Quito, said the roads were empty overnight, and people remained home after the police force went on strike.
"There [were] also reports of looting. Banks have been looted, some in the capital and some in the commercial city of Guayaquil," our correspondent said.
The government has declared a state of siege, putting the military in charge of public order, suspending civil liberties and allowing warrantless
Evo Morales, Bolivia's president, summoned the South American Union to an emergency meeting in Buenos Aires while Correa was still held in the hospital.
Heads of states on Friday denounced the police rebellion as an "attempted coup", saying they were determined "not to tolerate any new assault against the institutional authority."
Al Jazeera's Craig Mauro, reporting from Buenos Aires, said the meeting was a show of of South American unity and concern for democratisation across political lines.
"The presidents span a wide ideological spectrum from those on the socialist left, Evo Morales and Hugo Chavez, to right-wingers like Sebastian Pinera of Chile and Alan Garcia of Peru," he said.
"But all of them are saying the same thing – that this must be condemned. There will be unanimous agreement here that Correa should stay in power in Ecuador."
Correa had been attacked by police demonstrating against cuts to their bonuses and frozen promotions when he tried to talk to them earlier on Thursday.
A tear-gas cannister exploded close to the president's face and overcome by the fumes, he was taken to the nearby National Police Hospital.
Once inside, though, Correa was unable to leave, surrounded by mutinous police as clashes broke out in the streets of the capital.
A state of emergency was called after police stormed congress, blocked roads and set fires outside their barracks.
Although high-ranking military officials remained loyal to Correa, some soldiers joined the protests and seized Quito's main international airport, halting flights for several hours.
After his rescue, Correa gave special thanks to an elite police special operation unit that protected the hospital from the police protesters.
"If not for them, this horde of savages that wanted to kill, that wanted blood, would have entered the hospital to look for the president and I probably wouldn't have been telling you this because
I would have passed on to a better life," he said.
The president blamed the unrest on Lucio Gutierrez, a former president who came to power in a popular uprising and was deposed in 2005.
Interviewed by CNN in Brazil, Gutierrez denied "the cowardly, false, reckless accusations of President Correa."
Fransisco Dominguez, the head of the Centre of Brazilian and Latin American Studies at Middlesex University in the UK, told Al Jazeera that there were factors pointing to the involvement of Gutierrez.
"During the worst part of the crisis yesterday [Thursday], he called for the complete dissolution of parliament and also the resignation of Correa," he said.
Peru and Colombia closed their countries' borders with Ecuador in solidarity with Correa, re-opening them on Friday morning. Along with the rest of the region's leaders and the United States, they expressed firm support for Correa.
The law cutting police bonuses, which provoked the unrest, was approved by congress on Wednesday but has not yet taken effect because it must first be published.
Ecuador, with a population of 14 million, has a long history of political instability. Street protests toppled three presidents during economic turmoil in the decade before Correa was elected in 2006.
More than half of the 124-member congress are officially allied with Correa, but some in his left-wing Country Alliance party have been blocking budget proposals aimed at cutting state costs.
To solve the deadlock, Correa has said he is considering dissolving congress. Ecuador's two-year-old constitution allows the president to declare a political impasse that could dissolve congress until a new presidential and parliamentary elections can be held.
The measure would, however, have to be approved by the Constitutional Court to take effect.
Correa, an economist who obtained two masters degrees and a PhD in the US, was first elected in 2006 promising a "citizens' revolution" aimed at increasing state control of Ecuador's natural resources and fighting what he calls the country's corrupt elite.
Once in power, Correa backed the rewriting of the constitution to tilt the balance of power towards the executive branch of government. He easily won re-election in 2009, and under the new constitution he is allowed to stand again in 2013.
Source: Al Jazeera and agencies