QUITO President Rafael Correa reasserted control over Ecuador on Friday and his disgraced police chief resigned after officers' protests against spending cuts rattled the left-wing leader, who accused foes of a coup attempt.
Police commander Freddy Martinez took responsibility for a revolt by his officers on Thursday, when Correa was physically attacked and trapped in a hospital for several hours before troops rescued him in a blaze of gunfire.
"A commander shown such lack of respect by his subordinates cannot stay in charge," Martinez said.
Three presidents were ousted by popular protests in the decade before Correa took office in 2007 and for a period on Thursday, it appeared that Correa might be facing a serious challenge to his rule.
The fiery 47-year-old leader was contemptuous of the rebel police officers, who were protesting against proposed cuts to their bonuses, when he addressed supporters shortly after his rescue by loyal troops.
"For such a stupid thing like that, to damage the fatherland so much, history will judge them," he shouted.
State media said Correa's vehicle was hit by bullets as soldiers took him out of the hospital on Thursday night. "They wanted to kill President Correa," the Andes state news agency said, adding that the bullet-proof vehicle was hit four times.
Correa is expected to purge rebel officers from police ranks and he could also choose to dissolve Congress and rule by decree or call elections to try and solidify his power, although he might prefer to first let things cool down.
Correa is a close friend of Venezuela's socialist President Hugo Chavez, is part of the bloc of Latin American leaders fiercely critical of U.S. policy, and he alienated foreign investors when his government defaulted on $3.2 billion in global bonds,
SUPPORT AT HOME AND ABROAD
But he remains popular at home and he won support across the region on Thursday, from the White House to Havana. Even critics said it was important for Latin America and the United States to stand behind democratically-elected leaders.
Ecuadoreans were hugely relieved the crisis did not spill into wider bloodshed, as it has so often in this country of 14 million people, but Quito was nevertheless quiet on Friday, with many schools and businesses closed.
Colombia and Peru reopened their borders with Ecuador as fears of wider anti-Correa protests eased.
It was still not clear whether Correa was targeted in an organized coup attempt, as he and his supporters claim, or whether it was simply a protest that spiraled out of control.
The police were angered by plans to cut bonuses and freeze promotions as part of nationwide austerity measures that Correa is trying to push through in the face of a financial squeeze.
The U.S.-trained economist, limping after knee surgery he underwent last week, was jostled while confronting protesters on the street early on Thursday. Amid chaotic scenes, a tear gas canister was hurled at him and exploded near his face.
The Red Cross said two police officers died as troops later stormed the hospital where he took refuge. The government said one died. At least 88 other people were hurt during the day.
While some rank-and-file soldiers also joined the police protest, shutting down the city's main airport, the military's top brass stood by Correa.
Thousands of Ecuadoreans poured onto the streets to support him and, unlike during previous coups in OPEC's smallest member, there was no alternative leader waiting to take over.
It was, however, the toughest challenge yet to Correa, whose popularity has been stable at about 50 percent despite Ecuador's slow recovery from the global economic crisis.
His social initiatives -- including health and education programs, a $35 per month stipend for the poor and home-care programs for the handicapped -- have helped give him the strong base of support that eluded his predecessors.
Back in the presidential palace on Thursday night, an emotional and combative Correa vowed to push ahead with his "citizens' revolution," which hinges on the state taking more control over Ecuador's crucial oil sector.
"Nothing can defeat us," he told cheering, flag-waving supporters from the palace balcony.
Ecuador, which holds OPEC's rotating presidency, produces an average of 485,000 barrels of crude per day, and sends just under half of that to the United States.
The government is renegotiating contracts with oil companies including Italy's ENI, Brazil's Petrobras and Spain's Repsol-YPF. But the talks, aimed at ditching profit-sharing deals and making the companies service providers, have progressed slowly.
While Correa's survival and popular support -- plus the absence of a united opposition -- could strengthen his political hand in some ways, analysts also see troubled times ahead for the charismatic leader.
He still faces a potentially damaging showdown with Congress. Half of its 124 members are officially allied with him, but some in his left-wing Country Alliance party have been blocking budget proposals aimed at cutting spending.
Ecuador's 2-year-old constitution lets the president declare an impasse, dissolve Congress and rule by decree until a new presidential and parliamentary election.
Such a move -- which Correa has said he is considering -- would need to be approved by the Constitutional Court.
Christian Voelkel, a London-based analyst at IHS Global Insight, said the international backing Correa received would give him a boost over the short term.
"But over the long term the incident will accelerate the deterioration of the economic and political environment," Voelkel said. "Ecuador is heading for tumultuous times."
(Additional reporting by Santiago Silva and Guillermo Granja in Quito; Diego Ore, Daniel Wallis and Andrew Cawthorne in Caracas; Jack Kimball in Bogota; Guido Nejamkis and Helen Popper in Buenos Aires; Writing by Hugh Bronstein and Andrew Cawthorne; Editing y Daniel Wallis and Kieran Murray)