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 manoeuvres 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 ½ 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-Fateh el-Sissi, 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.”

“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.

Canada also referred to the takeover as a “coup” in a statement from the Foreign Affairs Ministry.

“Canada urges all parties in Egypt to remain calm, avoid violence and engage in meaningful political dialogue. This is important not only for Egypt, but, given Egypt’s influence, for the whole region as well,” Foreign Affairs Minister John Baird said in the statement.

“All Egyptians have the right to live in a free, democratic and secure society.”

U.S. President Barack Obama urged the military to move quickly to return Egypt to a democratically elected government, saying, “We are deeply concerned by the decision of the Egyptian armed forces to remove President Morsi and suspend the Egyptian constitution.”

The president notably did not refer to the military’s takeover as a coup — a phrase that would have implications for the $1.3 billion a year in U.S. military aid to Egypt.

The Egyptian military’s announcement came as huge crowds of pro- and anti-government demonstrators massed in the streets of Cairo and the army deployed armoured 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, who had deployed with dozens of armoured vehicles in the vicinity of the pro-Morsi demonstrations just hours before Sissi’s address, quickly began to set up walls of concertina wire to cordon off the anger.

Political analysts have warned that no matter how warmly the military’s move may have been received by the many liberal and secular Egyptians who deeply resent Islamist rule, it would not bode well for the country’s democratic future. Even if Egypt moves quickly to new elections, they said, future civilian leaders will govern with the knowledge that the military could step in at any time. Before Morsi’s election, the nation was effectively governed by the military for six decades.

Analysts have also cautioned that the military’s removal of an elected president could provoke an Islamist insurgency — much like what Algeria experienced in the 1990s after its powerful military cancelled an election ahead of an imminent Islamist victory at the polls.

Some of Morsi’s Islamist backers, whom television crews have filmed conducting military-styled exercises during their nighttime sit-ins, said Wednesday that they were prepared to fight.

The military arrested 12 top Muslim Brotherhood leaders in the early hours of Thursday morning, said Gehad el-Haddad, a spokesman for the group.

Haddad, whose father, top presidential aide Essam al-Haddad, was among those detained, said the arrests included “all of the presidential team” and some of the Brotherhood’s top political leaders.

The Brotherhood leaders who remained out of detention had not decided a plan of action. “It’s still in discussion,” Haddad said.

Sissi said Wednesday that a new media “code of ethics” would be adopted as part of the nation’s path forward, establishing “values and ethics for the media to follow.” He did not elaborate. But Egyptian security forces quickly shut down three satellite channels deemed sympathetic to the Brotherhood. They included the group’s Misr 25 channel and Al Jazeera’s Egypt affiliate.

Sissi also said that “peaceful protests” could continue, but he warned that the military would respond with “strength and determination” to any outbreaks of violence.

The military’s move had been telegraphed well in advance, beginning Monday when the generals announced that Morsi and his opponents had a 48-hour deadline to resolve their differences before the military imposed its own plan for the nation. Despite its announcement Wednesday night, the military has denied that it staged a coup.

Sissi was flanked by opposition leaders and religious authorities who the armed forces commander said had participated in meetings with the military to draft a new “road map” for the country.

Mohamed ElBaradei, the Nobel peace laureate and opposition leader who had been selected in recent days by activists to represent them, called the military’s move “a new start” for the country that would allow the Egyptian people “to regain their freedom and dignity.”

Ahead of the announcement Wednesday, Essam al-Haddad, the presidential aide, had declared that a military coup was already underway and warned that “considerable bloodshed” could ensue.

Within hours of Sissi’s speech, at least six Islamists were fatally shot in the town of Marsa Matrouh after allegedly opening fire on the police headquarters there. Violence was also reported in other towns and cities. Since Sunday, at least 39 people have been killed in clashes between Morsi’s supporters and his opponents.