CAIRO - Egypt's military has suspended the Islamist-backed constitution and called early elections.
The military also announced that embattled President Mohammed Morsi will be replaced.
Cheers erupted among millions of protesters nationwide who were demanding Morsi's ouster.
THIS IS A BREAKING NEWS UPDATE. Check back soon for further information. AP's earlier story is below.
Egypt's military moved to tighten its control of key institutions Wednesday, sending troops backed with armored vehicles to the heart of Cairo and slapping a travel ban on President Mohammed Morsi and top allies in preparation for an almost certain push to remove the Islamist president with the expiration of an afternoon deadline.
Just before the military's deadline expired, Morsi repeated a vow not to step down, and one of his top advisers decried that Egypt is experiencing a military coup.
For the second time in 2 1/2 years of political upheaval, the powerful army appears to be positioned to remove the country's leader. But this time, it would be ousting a democratically elected president, the first in Egypt's history - making its move potentially explosive.
Soon after the deadline passed, a military helicopter circled over the anti-Morsi crowds in Cairo's central Tahrir Square, which was transformed into a sea of furiously waving Egyptian flags. "Leave, leave," they chanted to Morsi, electrified as they waited to hear of an army move. After nightfall, fireworks went off and green lasers flashed over the crowd.
Millions were in the main squares of major cities nationwide, demanding Morsi's removal, in the fourth day of the biggest anti-government rallies the country has seen, surpassing even those in the uprising that ousted against his autocratic predecessor Hosni Mubarak.
The troops, including commandos and in full combat gear, deployed just as darkness fell across much of the Egyptian capital at key facilities, on bridges over the Nile River and at major intersections. They also surrounded rallies being held by Morsi's supporters - an apparent move to keep them contained if a final move on the president is made.
Morsi's Islamist supporters have vowed to resist what they call a coup against democracy, and have also taken to the streets by the tens of thousands. Still, at the Rabia al-Adawiya Mosque, their main rally, some sought to depict the soldiers sealing off the nearby streets as on their side. They handed them flags, took pictures with them and chanted, "The army and people are one hand."
At least 39 people have been killed in clashes since Sunday, raising fears of further bloodshed. Egypt was mostly peaceful on Wednesday, with the only report of violence coming from the Nile Delta city of Kafr el-Sheikh where supporters and opponents of Morsi clashed. At least 200 people were injured there, but no fatalities.
Earlier in the day, the head of the army, Defense Minister Gen. Abdel-Fattah el-Sissi, met with leading reform advocate Mohammed ElBaradei, Egypt's top Muslim cleric - Al-Azhar Sheik Ahmed el-Tayeb - and Coptic Pope Tawadros II to discuss its political road map, a spokesman for the senior opposition National Democratic Front, Khaled Daoud, said on state TV.
Also attending were a representative of the new youth movement behind this week's protests and some members of the ultraconservative Salafi movements, a Defense Ministry official told The Associated Press. The official spoke on condition of anonymity because he was not authorized to speak to the media.
A travel ban was put on Morsi and the head of his Muslim Brotherhood, Mohammed Badie, as well as Badie's deputy Khairat el-Shater, according to officials at the airport, who spoke on condition of anonymity because they were not authorized to talk to the press.
Also banned from leaving the country were the Brotherhood's former leader Mahdi Akef, senior Brotherhood figure Mohammed el-Beltagi, a major Salafi preacher close to the Brotherhood Safwat Hegazy and the leader of the Islamist Wasat party Abou Ela Madi and his deputy Essam Sultan.
In a last-minute statement before the deadline, Morsi again rejected the military's intervention, saying abiding by his electoral legitimacy was the only way to prevent violence. He criticized the military for "taking only one side."
"One mistake that cannot be accepted, and I say this as president of all Egyptians, is to take sides," he said in the statement issued by his office. "Justice dictates that the voice of the masses from all squares should be heard," he said, repeating his offer to hold dialogue with his opponents.
The free electing of a president had been one of the aspirations of the 2011 revolt that toppled Mubarak. Morsi's opponents say they want to remove a president who has lost his legitimacy by trying
to monopolize power with Islamists - even if it takes army intervention to bring in new leadership and put the country on a more democratic path.
But on his Facebook page, Morsi's top foreign policy adviser Essam al-Haddad
wrote, "For the sake of Egypt and for historical accuracy, let's call what is happening by its real name: Military coup."
At the main pro-Morsi rally in Cairo, thousands of his Islamist supporters chanted, "Wake up el-Sissi, Morsi is my president."
"We will not bring back the military rule," they chanted outside the Rabia al-Adawiya Mosque. "Will not happen, will not happen," they shouted.
The army has insisted it is not carrying out a coup, but acting on the will of the people to clear the way for a new leadership. Under a plan leaked to state media, the military would install a new interim leadership, the Islamist-backed constitution suspended and the Islamist-dominated parliament dissolved.
But on Wednesday it clearly was positioning itself to maintain control during any unrest sparked by a move on Morsi.
The military beefed up its presence inside the mammoth headquarters of state TV on the banks of the Nile in central Cairo. Crack troops were deployed in news production areas. Officers from the army's media department moved inside the newsroom and were monitoring output, though not yet interfering, staffers said, speaking on condition of anonymity because they were not authorized to talk about the arrangements.
State TV is run by the information minister, a Muslim Brotherhood member appointed by Morsi, and its coverage had largely been in favor of the government. But in the past two days, the coverage saw a marked shift, with more balanced reporting showing anti-Morsi protests along with those supporting him. State radio has seen a similar shift.
The state-run Al-Ahram newspaper - which also seemed to be following a military line - reported that the military had placed several leaders of Morsi's Muslim Brotherhood under surveillance.
Airport officials said screening departing passengers has been tightened to ensure leaders of the Brotherhood and other Islamist groups don't slip out with the help of sympathetic airport employees.
In a speech late Tuesday night, Morsi vowed not to step down and pledged to defend his legitimacy with his life in the face of the massive street protests.
Morsi demanded that the powerful armed forces withdraw their ultimatum, saying he rejected all "dictates" - from home or abroad. The army said if no agreement is reached between Morsi and the opposition it would intervene to implement a political road map of its own.
In his emotional, 46-minute address aired live to the nation late Tuesday, the Islamist leader accused loyalists of his ousted autocratic predecessor Hosni Mubarak of exploiting the wave of protests to topple his regime and thwart democracy.
"There is no substitute for legitimacy," said Morsi, at times angrily raising his voice, thrusting his fist in the air and pounding the podium. He warned that electoral and constitutional legitimacy "is the only guarantee against violence."
The speech showed that Morsi and the Muslim Brotherhood are prepared to run the risk of challenging the army. It also entrenches the lines of confrontation between his Islamist supporters and Egyptians angry over what they see as his efforts to impose control through the Brotherhood and his failures to deal with the country's multiple problems.
The Interior Ministry, in charge of the police, increased the pressure on Morsi. It pledged in a statement to stand by and protect the protesters against violence. "We are all the Egyptians, and at the face of the military, we are standing," they screamed.
Mahmoud Badr, spokesman for Tamarod, or Rebel - the youth movement behind the latest rallies - called on anti-Morsi protesters to demonstrate outside three presidential palaces as well as the Cairo headquarters of the Republican Guard, an army branch that protects the president, his family and their residences and offices. Morsi is thought to have been working at the Republican Guard headquarters since the start of the protests.
Badr also called on the army to place Morsi under arrest for his alleged incitement to civil war.
"Today is the day of decisiveness," Badr said at a news conference.
Morsi's opponents say he has lost his legitimacy through mistakes and power grabs, and that their turnout on the streets shows the nation has turned against him.
On Tuesday, millions of jubilant, chanting Morsi opponents again filled Tahrir Square and avenues adjacent to two presidential palaces in the capital, and main squares in cities nationwide. After Morsi's speech, they erupted in indignation, banging metal fences to raise a din, some raising their shoes in the air in a show of contempt. "Leave, leave," they chanted.
The president's supporters also moved out in increased marches in Cairo and other cities, and stepped up warnings that it will take bloodshed to dislodge him. While Morsi has stuck to a stance
that he is defending democracy in Egypt, many of his Islamist backers have presented the fight as one to protect Islam.
Fearing that Washington's most important Arab ally would descend into chaos, U.S.
officials said they are urging Morsi to take immediate steps to address opposition grievances, telling the protesters to remain peaceful and reminding the army that a coup could have consequences for the massive American military aid package it receives. The officials spoke on condition of anonymity because they were not authorized to speak publicly.
The army has insisted it has no intention to take power. But the reported road map showed it was ready to replace Morsi and make a sweeping change in the ramshackle political structure that has evolved since Mubarak's fall in February 2011.
The constitution and domination of the legislature after elections held in late 2011-early 2012 are two of the Islamists' and Brotherhood's most valued victories - along with Morsi's election last year.