(CNN) -- Ecuador teetered on the verge of a government collapse Thursday, as national police took to the streets of Quito, the capital, and physically attacked the president over what police say was the cancellation of bonuses and promotions.
The government declared a one-week state of emergency Thursday afternoon and put the military in charge of security. The military said it will support the president and the nation's democratic institutions.
"This is a coup attempt," President Rafael Correa said in a TV interview a couple of hours after police lobbed tear gas at him.
Correa, who was forced to flee to a nearby hospital, said police were trying to get at him.
"They're trying to get into my room, maybe to attack me. I don't know," he said in a telephone interview with state-run Ecuador TV. "But, forget it. I won't relent. If something happens to me, remember my infinite love for my country, and to my family I say that I will love them anywhere I end up."
A video by CNN affiliate Ecuavisa later showed a defiant Correa standing at an upper floor window, shouting to a crowd of supporters, "If they want me, here I am," and then rapidly ripping his necktie loose.
A broadcast by Ecuador TV showed mobs on the streets and clouds of black smoke rising from burning tires and garbage. Sporadic looting was reported.
Correa had taken to the streets to try to negotiate with police but was soon surrounded and jostled by a crowd and fled after someone fired a tear gas canister at him. Some of those shoving him were dressed as police officers in full gear.
Video from CNN affiliate Teleamazonas showed a man in a tan suit punching Correa and trying to yank a gas mask off the president's face.
The broadcast then showed a hunched-over Correa being led away, his face still covered by the gas mask. Correa, who recently underwent knee surgery, leaned on a crutch with his left arm.
A news photograph later showed him lying on a stretcher.
A government helicopter had tried to evacuate him but was unable to land.
He went on the air from a hospital a couple of hours later to denounce what he called a cowardly attack.
"They fired gas on us -- on the president of the republic," Correa said in a telephone interview with Ecuador TV. "This is treason to the country, treason to their president."
Foreign Minister Ricardo Patino led a large and boisterous pro-government rally at the Carondelet Palace, the president's home. He urged the crowd to take to the streets to peacefully "reject this coup" and "to rescue our president."
Said Patino, "We are not afraid of anyone."
Analysts pointed to the government's precariousness.
"This is the most serious protest that the government of Rafael Correa has faced," analyst Eduardo Gamarra told CNN en Espaņol.
Rank-and-file police took over their agency's headquarters, Ecuador TV said.
There also were reports that the military had taken control of their bases and the airport.
Ecuador has nearly 58,000 members in its military and 33,000 in the national police force, according to Jane's Intelligence Review.
The military, Jane's said, is undergoing a professionalism transformation designed to give it greater flexibility.
The National Civil Police, meanwhile, is the nation's major law enforcement organization.
Government officials tried to quell the rebellion, insisting that the security forces had been misinformed and warning that the nation's democracy was in danger.
"I want to tell the country there has been an attempt at a coup," said Gabriel Rivera of the Country Accord Party.
"This is a Machiavellian plan organized by sectors of the right," Rivera said on Ecuador TV.
Miguel Carvajal, the minister for interior security, said there was no threat to salaries or benefits. He blamed the reports of the benefit cuts on a massive disinformation campaign.
"He who says that is lying," Carvajal said.
"We call on the citizens. We call on the armed forces. We call on other governments to defend our democratic institutions," he said.
A police spokesman went on the air on Teleamazonas to dispute the government's allegations, saying that the security forces were in fact supporting Correa.
"Fellow officers who hear me nationally, stop this action," said the spokesman, identified only as Sgt. Mejia. "Don't close the streets. Return to the streets to work."
The disturbances occurred as Correa threatened to dissolve the national assembly over a dispute about several laws, including public service and education.
Angry police said they were overworked and underpaid.
"We work 14 hours a day," a uniformed officer said on Ecuador TV. "We are the ones who never protest."
Said another: "One hour without police. Let's see what happens."
Diego Borja, director of the central bank, went on the air to urge calm and for people to take care.
"The police are not protecting the people. They are protesting," he said. "There could be problems."
He also sought to prevent a run on deposits.
"The money is safe," he said. "But be careful if making large withdrawals."
Peru closed its border with Ecuador, and messages of support for Correa came from 10 Latin American nations: Argentina, Venezuela, Mexico, Colombia, Peru, Chile, Bolivia, Costa Rica, Cuba and Honduras. The Organization of American States also voted to support Correa.
The support from Honduras came a little over a year after a military-led coup toppled the democratically elected president there. Correa had criticized that coup, as did most nations in the world. Honduras has held elections since then and elected a president.
CNN's Rafael Romo contributed to this report.