A video by CNN affiliate Ecuavisa later showed a defiant Correa standing at an upper floor window, shouting to a crowd of supporters who had gathered outside the hospital, "If they want me, here I am," and then ripping his necktie loose.
Later, he told a television station by telephone from the hospital that, if he were killed, he would be replaced by thousands of revolutionaries. "The most I have to lose is my life," he said. "They're going to achieve absolutely nothing!"
Correa told a reporter said he was in good health and he thanked the presidents of countries around that world who have called him to express their support.
In response to a question, Correa said he believed he had been kidnapped by police, since he was not being allowed to leave the hospital. He added that he would not reach any agreement with the protesters until they abandon their positions and leave police headquarters.
But Doris Solis, the coordinating minister of politics, disagreed with his characterization of events. "This is not a coup," Solis told CNN en Espanol. She said Correa was speaking with police representatives inside the hospital.
Solis also said Correa would return to his office within a few hours to meet with his cabinet members.
Correa said a law passed Wednesday by the National Assembly does not cut compensation bonuses of police, as some have asserted, and he accused the news media and his political opponents of misinforming the public about the legislation.
Demonstrators who had gathered outside of the hospital where the president was being held were dispersed by tear gas but returned.
Maria Paula Romo, congresswoman of Correa's party, Alianza Pais, posted on her Facebook page at 3:30 p.m. (4:30 p.m. ET): "Repression and gas bombs outside of the hospital where president Correa remains. People continue to gather to support the president."
Vice President Lenin Moreno was in Guayaquil and unable to travel to Quito because the airports were closed.
Meanwhile, schools were closed and children were sent home around noon Thursday. The schools are to remain closed Friday and until a new mandate overturns the decision.
"We can guarantee the citizens that order and security are slowly being re-established," a military official, Commandant Jorge Gross, said on television at 6:30 p.m. (7:30 p.m. ET).
But that was not clear everywhere. A spokesman for government-run television said police were trying to cut the station's power supply. As the station's anchors reported the news, cameras showed people trying to enter the studio by pushing on a locked glass door. A few minutes later, the camera shot cut to a different studio, and a station manager said protesters had broken into the studio and shattered windows in the building.
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.
But by dusk, officials reported that the situation appeared to be stabilizing. "We've taken control of all of the city of Guayaquil as of 5 p.m.," (6 p.m. ET), said Roberto Cuero, governor of Guayas province. "The city has begun to recover tranquility."
Guayaquil, Ecuador's largest city and the birthplace of Correa, was under military control.
The challenge to Correa occurred after he had taken to the streets to try to negotiate with police but was soon surrounded and jostled by a crowd. He then 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."
Hours later, thousands of government supporters remained assembled outside the palace, where many of them vowed to stay until Correa returns.
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 Espanol.
Rank-and-file police took over their agency's headquarters, Ecuador TV said.
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.
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."
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.
Colombian President Juan Manuel Santos said on Caracol TV that he was closing his country's border with Ecuador. He went on to say he was heading to an emergency meeting Thursday night in Argentina of UNASUR, the United Nations of South America.
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.
At the United Nations, a spokesperson for Ban Ki-moon said the secretary-general "expresses his strong support for the country's democratic institutions and elected government," was concerned about Correa's physical condition and personal welfare and called on all involved "to resolve the current crisis peacefully, within the rule of law."
In Washington, Secretary of State Hillary Clinton said U.S. officials were closely following the events. "The United States deplores violence and lawlessness and we express our full support for President Rafael Correa, and the institutions of democratic government in that country," she said. "We urge all Ecuadoreans to come together and to work within the framework of Ecuador's democratic institutions to reach a rapid and peaceful restoration of order."
In a statement from its base in Atlanta, Georgia, the Carter Center said it was "deeply concerned" about the reports and "expresses its support for the constitutional government of [Ecuador] and its democratically elected President Rafael Correa Delgado. We lament the disturbances and violence. The center urges that the problems be resolved quickly through respect for the rule of law and constitutional means."
Correa was elected president in 2006 and took office in 2007. He earned a Ph.D. in economics from the University of Illinois at Urbana-Champaign in 2001. Ecuador's government appeared teetering on the verge of collapse Thursday, as national police took to the streets of Quito, the capital, and physically attacked the president over what police said was the cancellation of bonuses and promotions.
The minister of security, Miguel Carvajal, said one person was killed and several were wounded, but did not offer details.
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 from the hospital, where he had been taken after police lobbed tear gas at him.
Correa, 47, said police were trying to get at him there.
"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, referring to his attackers as "cowards."