CAIRO — Egypt’s military officers removed the country’s first democratically elected president, Mohammed Morsi, on Wednesday, suspended the constitution and installed an interim government presided over by a senior jurist.

Tahrir Square, where tens of thousands of opponents of the government had gathered each night since Sunday to demand Morsi’s removal, erupted in fireworks and jubilation at news of the ouster. At a square near the presidential palace where Morsi’s Islamist supporters had gathered, men broke into tears and vowed to stay until he was reinstated or they were forcibly removed.

“The dogs have done it and made a coup against us,” they chanted. “Dying for the sake of God is more sublime than anything,” a speaker declared. Morsi rejected the generals’ actions as a “complete military coup.”

Military vehicles and soldiers in riot gear had surrounded the rally in the hours before the takeover, and tensions escalated through the night. Within hours, at least seven people had died and more than 300 were injured in clashes in 17 provinces between Morsi’s supporters and either civilian opponents or security forces.

By the end of the night, Morsi was in military custody and blocked from all communications, one of his advisers said, and many of his senior aides were under house arrest. Egyptian security forces had arrested at least 38 senior leaders of the Muslim Brotherhood, including Saad el-Katatni, the chief of the group’s political party, and others were being rounded up, security officials said. No immediate reasons were given for the detentions.

For Morsi, it was a bitter and ignominious end to a tumultuous year of bruising political battles that ultimately alienated millions of Egyptians. Having won a narrow victory, his critics say, he broke his promises of an inclusive government and repeatedly demonized his opposition as traitors. With the economy crumbling, and with shortages of electricity and fuel, anger at the government mounted.

Khaled Desouki/AFP/Getty Images

The Egyptian army sent dozens of tanks to locations where President Mohammed Morsi’s supporters had gathered.

The generals built their case for intervention in a carefully orchestrated series of maneuvers, calling their actions an effort at a “national reconciliation” and refusing to call their takeover a coup. At a televised news conference late Wednesday, Gen. Abdul-Fattah el-Sissi said the military had no interest in politics and was ousting Morsi because he had failed to fulfill “the hope for a national consensus.”

The general stood on a broad stage, flanked by Egypt’s top Muslim and Christian clerics and a spectrum of political leaders including Mohamed ElBaradei, the Nobel-prize winning diplomat and liberal icon, and Galal Morra, a prominent Islamist ultraconservative, or Salafi, all of whom endorsed the takeover.

Despite their protestations, the move plunged the generals back to the center of political power for the second time in less than three years, following their ouster of former President Hosni Mubarak in 2011. Their return threatened to cast a long shadow over future efforts to fulfill that revolution’s promise of a credible, civilian democracy. But Sissi sought to present a very different image from the anonymous, numbered communiqués from the Supreme Council of the Armed Forces that were solemnly read over state television to announce Mubarak’s exit, and the general emphasized that the military had no desire to rule.

“The armed forces was the one to first announce that it is out of politics,” Sissi said at the start. “It still is, and it will remain away from politics.”

Under a “road map” for a post-Morsi government devised by a meeting of civilian political and religious leaders, the general said, the constitution would be suspended, the chief justice of the Supreme Constitutional Court, Adli Mansour, would become acting president and plans would be expedited for new parliamentary and presidential elections under an interim government.

At the White House, 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.

Amr Nabil/Associated Press

Fireworks lit up the sky above Tahrir Square on Wednesday as tens of thousands of opponents of Mohammed Morsi celebrated his removal by military officers.

Still, there was no mistaking the threat of force and signs of a crackdown.

Armored military vehicles rolled through the streets of the capital, surrounded the presidential palace and ringed in the Islamists. The intelligence services put travel bans on Morsi and other top Brotherhood leaders.

The Brotherhood’s satellite television network was removed from the air along with two other popular Islamist channels. The police arrested at least two prominent Islamist television hosts, and many others who worked at those channels, as well as people who worked at a branch of the Al-Jazeera network considered sympathetic to Morsi, security officials said. And state television resumed denouncing the Brotherhood as it once did under Mubarak.

Moments after Sissi spoke last Wednesday, however, Morsi released a short video over a presidential website delivering a final, fiery speech denouncing the ouster.

“I am the elected president of Egypt,” he declared. “I am ready to sit down and for everybody to sit with me and to negotiate with everybody.”

“The revolution is being stolen from us,” he repeated.

Minutes later, the website was shut down, the video disappeared and he emailed journalists a statement “as the president of the Republic and the Chief Commander of the Armed Forces” urging all to follow the rules of the recently approved constitution. Then he called the takeover “a complete military coup which is categorically rejected by all the free people of the country who have struggled so that Egypt turns into a civil democratic society.”

And in a sign of how little Morsi ever managed to control the Mubarak bureaucracy he took over, the officers of the Presidential Guard who had been assigned to protect him also burst into celebration, waving flags from the roof of the palace.

Although the tacit control of the generals over Egyptian politics is now unmistakable, Sissi laid out a more detailed and faster plan for a return to civilian governance than the now-retired generals who deposed Mubarak did two years ago. Sissi made no mention of any period of military rule and granted the acting president, Mansour, the power to issue “constitutional decrees” during the transition.

Mansour was named to the bench by Mubarak two decades ago, before Mubarak sought to pack the court with more overtly political loyalists or anti-Islamists. Mansour ascended to the post of chief only a few days ago and, while he is said to be highly regarded, not much is known of his views or how much authority he will truly wield.

Sissi called for the formation of a “technocratic government” to administer affairs during the transition and also a politically diverse committee of experts to draft constitutional amendments. It was not clear who would form the government or the committee. The general said that the constitutional court would set the rules for the parliamentary and presidential elections, and that the court would also “put forward a code of ethics to guarantee freedom of the press and achieve professionalism and credibility” in the news media.

The general’s plan bore a close resemblance to one proposed in recent days by the ultraconservative Islamist Nour Party and suggested that he was seeking to bring in at least some Islamists as well as liberals and leftists to support the overthrow of the Muslim Brotherhood. The Nour Party, which quickly endorsed the plan, had joined other political groups in accusing Morsi and the Brotherhood of monopolizing power at the price of a dangerous political polarization.

Unlike liberals, however, the ultraconservative Islamists were keen to avoid the installation of a liberal like ElBaradei as a transitional prime minister, or to see the current constitution — with its prominent recognition of Islamic law — scrapped instead of revised. It was unclear whether the generals planned to allow the Brotherhood to compete in parliamentary elections and potentially retake its dominant role in the legislature, which could give it the ability to name a new prime minister.

Brotherhood leaders urged Islamists to resist.

“The people will not surrender,” Essam el-Erian, a senior Brotherhood political leader, declared on the group’s satellite channel before it disappeared from the air. “The military will reach the point when the conflict is no longer between political opponents. Instead the military will be in confrontation with a large sector of the people — I daresay the bigger part.”

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.