CAIRO – A year after coming to office, Egypt’s first democratically elected president was swept aside by the military leaders who long presided over this country and proved Wednesday in a series of extraordinary maneuvers that they never really left.

President Mohammed Morsi’s dramatic fall from power came after months of political turmoil and days of tense protests, as millions of Egyptians took to the streets to call for his exit. Those protesters were jubilant Wednesday night, celebrating the ouster of a leader they viewed as both autocratic and incompetent.

But Morsi’s Muslim Brotherhood supporters were irate, and Morsi himself was adamant that he remained the nation’s president. Aides said early Thursday that he was under house arrest as security forces rounded up at least a dozen top Muslim Brotherhood leaders, shuttered three television stations and surrounded Islamist demonstrators. Troops and tanks fanned out across Cairo, as clashes erupted in several cities.

Although the generals promised fresh elections, they gave no timetable. For now, Morsi’s ouster underscores the elusiveness of democracy in the Arab world’s largest country, about 2 1/2 years after another popular uprising prompted Egypt’s military to end the three-decade reign of Hosni Mubarak.

The abrupt conclusion of Morsi’s year-long tenure came in a televised address to the nation by the head of Egypt’s armed forces, Gen. Abdel Fatah al-Sissi, early Wednesday evening. The move, he said, was aimed at resolving the country’s debilitating political crisis.

Sissi said that the country’s new constitution — ratified under Morsi — would be suspended and that the chief of Egypt’s constitutional court will assume the presidency on an interim basis until the elections are held. Sissi said the interim president — Adly Mansour, who assumed the position of the nation’s top judicial authority just three days ago — will have the right to declare laws during the transitional period.

Without mentioning Morsi by name in his eight-minute speech, Sissi said the military had responded to the Egyptian people’s demands in an act of “public service.”

“The armed forces have tried in recent months, both directly and indirectly, to contain the internal situation and to foster national reconciliation between the political powers, including the presidency,” Sissi said. But those efforts failed, he said. The president, he added, “responded with negativity in the final minutes.”

Afterward, Morsi and his supporters were defiant.

“Measures announced by the armed forces’ leadership represent a full coup categorically rejected by all the free men of our nation,” Morsi tweeted from his official Twitter account Wednesday night after Sissi’s statement.

The military’s announcement came as huge crowds of pro- and anti-government demonstrators massed in the streets of Cairo and the army deployed armored vehicles. Tahrir Square erupted into a roar of cheers, air horns and fireworks. The Egyptian capital’s streets were immediately clogged with cars and motorcycles flying the national flag; a celebratory cacophony of horns and shouts continued into the early morning.

Across town, tens of thousands of Morsi supporters, who had gathered to defend what they called the “constitutional legitimacy” of Egypt’s first elected leader, broke into enraged chants as news of Morsi’s ouster came crashing down upon them.

Soldiers quickly began to set up walls of concertina wire to cordon off the anger.