Cairo (CNN) -- Egypt's military deposed the country's first democratically elected president Wednesday night, installing the head of the country's highest court as an interim leader, the country's top general announced.
Gen. Abdel-Fatah El-Sisi said the military was fulfilling its "historic responsibility" to protect the country by ousting Mohamed Morsy, the Western-educated Islamist leader elected a year ago. The country's constitution has been suspended, new parliamentary elections will be held and Adly Mansour, the head of the country's Supreme Constitutional Court, will replace Morsy, El-Sisi said.
Mansour will have the power to issue constitutional declarations during the interim period and will "establish a government that is a strong and diverse," the armed forces chief said. He said Morsy "did not achieve the goals of the people" and failed to meet demands to share power with opponents who thronged the streets of Cairo and Tahrir Square.
Those crowds erupted as the announcement was made on Egyptian television shortly after 9 p.m. (3 p.m. ET). But Morsy supporters gathered in another Cairo plaza vowed to oppose the coup, chanting "Down with military rule" and "The square has a million martyrs."
And in statements posted on the presidential Facebook and Twitter pages, Morsy said his ouster would be "categorically rejected by all the free men of our nation."
"The president -- who is also the supreme commander of the armed forces -- tells all citizens, civilians and military, leaders and soldiers, must abide by the constitution and should not respond to the coup which brings Egypt behind," he said. "Everyone must take responsibility before God, people and history."
Ahead of the statement, troops moved into key positions around the capital, closing off a bridge over the Nile River and surrounding a demonstration by Morsy's supporters in a Cairo suburb.
As the hour of the ultimatum neared, Morsy offered to form an interim coalition government "that would manage the upcoming parliamentary electoral process, and the formation of an independent committee for constitutional amendments to submit to the upcoming parliament," he said in a posting on his Facebook page. He noted that hundreds of thousands of supporters and protesters had packed plazas around the country, and he urged that his countrymen be allowed to express their opinions through the ballot box.
"One of the mistakes I cannot accept -- as the president of all Egyptians -- is to side with one party over another, or to present the scene from one side only. To be fair, we need to listen to the voice of people in all squares," the statement read.
Morsy, a U.S.-educated religious conservative, was elected president in June 2012. But his approval ratings have plummeted as his government has failed to keep order or revive Egypt's economy. The chaos, including open sexual assaults on women in Egypt's streets, has driven away tourists and investors, while opponents say Morsy's rule was increasingly authoritarian.
As the troops fanned out Wednesday evening, Morsy was said to be working from a complex belonging to the country's Republican Guard, across the street from the presidential palace, according to Egyptian state media.
In Washington, State Department spokeswoman Jen Psaki said the U.S. government -- Egypt's leading ally -- could not confirm reports of a coup. Psaki said the United States is not taking sides and urged all parties to come to a peaceful resolution to the "tense and fast-moving" situation.
An aide, Essam El Haddad, said in a Facebook posting that a coup was under way and warned that the generals risked bloodshed by moving against Morsy.
"Today, only one thing matters. In this day and age, no military coup can succeed in the face of sizable popular force without considerable bloodshed," wrote El Haddad, who works in the office of the assistant to the president on foreign relations. "Who among you is ready to shoulder that blame?"
"In a democracy, there are simple consequences for the situation we see in Egypt: The president loses the next election or his party gets penalized in the upcoming parliamentary elections. Anything else is mob rule," he added.
But Naguib Abadeer, a member of the opposition Free Egyptians Party, said what was under way "is not by any means a military coup. This is a revolution."
"The people have decided that Mr. Morsy was no longer the legitimate leader of Egypt," he told CNN.
Abadeer said Morsy lost his legitimacy in November, when he declared courts could not review his decrees and ousted the country's prosecutor-general. He said Morsy's supporters in the Muslim Brotherhood -- the Islamist movement that propelled Morsy to the presidency -- "hijacked the vote of the people" by running on a religious platform, "so these were not democratic elections."
On Tuesday night, Morsy had vowed that he would not comply with the military's 48-hour ultimatum and demanded that the armed forces stand down.
"If the price of upholding this legitimacy is my own blood, I am, therefore, ready to sacrifice my blood for this country and its stability," he said.
But political analyst Hisham Kassem said the speech was Morsy's "final bluff."
"He was trying to give the impression 'We are there in numbers, and we are going to retaliate, we are not going to allow this to happen.' However, with almost 24 hours since his message, it's clear his supporters will not dare challenge the crowds on the street," Kassem said.
He added, "I think President Morsy effectively is no longer running the country." And faced with the throngs that filled Cairo's Tahrir Square, "the military had to intervene. Otherwise this crowd was going to get Morsy from his palace."
Reports of a TV studio takeover
Reuters and several other news organizations reported that Egyptian troops had "secured the central Cairo studios of state television" as the deadline approached and that staff not working on live shows had departed.
CNN has not confirmed the reports; state television denied in an on-air banner that there was any additional military presence at its studios.
Massive demonstrations for and against the former Muslim Brotherhood leader who was elected to office a year ago have been largely peaceful.
But 23 people died, health officials said, and hundreds more were injured in clashes overnight at Cairo University, the state-funded Al-Ahram news agency reported.
Protest leaders have called for nonviolence.
Egypt's military met Wednesday with religious, national, political and youth leaders to address the crisis, Egyptian military spokesman Ahmed Ali said through his Facebook page.
Hours earlier, an opposition spokesman accused the United States of propping up Morsy out of concern for neighboring Israel.
"The hour of victory is coming," said Mahmoud Badr of the Tamarod opposition group. He predicted that the "illegitimate president" would be gone by the end of the day.
"Not America, not Morsy, not anyone can impose their will on the Egyptian people," Badr said.
With the ultimatum, the armed forces appeared to have thrown their weight behind those opposed to Morsy's Islamic government.
Early Wednesday, soldiers and police set up a perimeter around the opposition's central meeting point, Cairo's Tahrir Square, "to secure it from any possible attack," the state-run EgyNews agency reported.
It was the police who, on the same spot in 2011, killed hundreds when they fired upon democratic, moderate and Islamic demonstrators seeking to overthrow Hosni Mubarak, the country's longtime autocratic leader and U.S. ally.
Mubarak had repressed the Muslim Brotherhood, an Islamic political movement that emerged as the nation's most powerful political force once Mubarak was ousted.
At a pro-democracy protest in Cairo, demonstrators expressed anger and fear over what the coming hours could bring.
The Muslim Brotherhood spokesman, Gehad El-Haddad, told CNN that tanks and armored vehicles -- accompanied by thugs carrying knives, pistols and ammunition -- had been moved to the northern and southern entrances of the square in an apparent attempt to drive them out.
The military fired warning shots into the air, and shot one Muslim Brotherhood member in the leg, El-Haddad said, but the remaining protesters were standing in defiance in front of the tanks.
Some of the protesters oppose Morsy but also oppose pushing from power a democratically elected leader, he said. "Under no circumstances will we ever accept a military-backed coup," he said.
But many of the democratic reformers and moderates who accused Morsy's government of moving in an authoritarian direction now support former Mubarak allies and others fed up with the nation's direction in calling for the restoration of order through the military.
They have been pushing to oust Morsy and his Muslim conservative government, whose leaders were drawn primarily from the ranks of the Muslim Brotherhood. They say they have collected more than 20 million signatures on a petition to remove him -- millions more than the number who voted Morsy into the presidency.
In recent days, anti-Morsy demonstrators have ransacked Muslim Brotherhood offices all over the country.
The military's plans
Military leaders have told Arab media that they were planning to suspend the constitution, dissolve the parliament and sideline Morsy.
In his place, they would install a mainly civilian interim council until a new constitution can be drafted and a new president elected.
The military's ultimatum was intended to push all factions toward a national consensus, not to seize power through a coup, a spokesman, Col. Ahmed Ali, said Monday in a written statement.
The military appeared to be pressuring Morsy to reduce the influence of the Muslim Brotherhood and include opposition members, a source close to highly placed members of Egypt's leadership told CNN.
That restructuring was already happening. Five of Morsy's ministers resigned this week, including Foreign Minister Mohamed Kamel Amr.
And former Prosecutor General Abdel-Meguid Mahmoud will meet Thursday with the Supreme Judicial Council to be confirmed in the job.
Mahmoud had originally been installed in the job by Mubarak, shortly before he left. One of the goals during the 2011 revolution had been to oust him, which Morsy did through last November's constitutional declarations.
Mahmoud's return appeared to signify a shrinking of Morsy's power and a tilt toward Mubarak-era officials over Muslim Brotherhood loyalists.
In addition, 30 members of the Shura Council, the upper house of parliament, have resigned, state-run Nile TV reported.
Morsy defends his presidency
Morsy's numerous and adamant supporters point out that he is the legitimate president and say that opponents seeking to depose him are circumventing the democratic process.
The unrest prompted U.S. President Barack Obama to call Morsy on Monday and urge a less rigid stance. "He stressed that democracy is about more than elections," a White House statement said.
A White House official told CNN that Obama was briefed on the situation in Egypt on Wednesday by his national security staff.
The Obama administration appeared to be giving mixed signals on where it stands. On Tuesday, Obama called on Morsy to hold early elections, a senior administration official said.
"We are saying to him, 'Figure out a way to go for new elections,'" the official said. "That may be the only way that this confrontation can be resolved."
A State Department spokeswoman, however, denied that Obama urged early elections.
CNN's Tom Watkins, Hamdi Alkhshali, Dan Lothian, Amir Ahmed, Ben Brumfield, Ali Younes, Chelsea Carter, Schams Elwazer, Elise Labott, Ben Wedeman, Ian Lee, Housam Ahmed and Salma Abdelaziz contributed to this report.