In a stunning turnaround for a country that deposed longtime strongman Hosni Mubarak only two years ago in a popular revolt, his democratically elected successor, Mohamed Morsi, has been swept from power by a military riding a wave of popular protests against Morsi's Islamist government.

A massive crowd of protesters cheered in Cairo's Tahrir Square on Wednesday after General Abdel Fattah al-Sisi announced that Morsi had been ousted by the military.

Al-Sisi said that Egypt's Islamist-based constitution was being suspended, and that Morsi would be replaced in the interim by Adly Mansour, chief justice of the Supreme Constitutional Court.

While al-Sisi called for special elections to be held, he did not specify when that might happen. He insisted that the military was not seizing power for itself, and that the interim government of technocrats would have "full powers" to govern the country.

Millions of anti-Morsi protesters filled the area around Tahrir Square in recent days to voice their displeasure with Morsi and the Muslim Brotherhood. Protesters said the Brotherhood had forced an Islamist constitution through parliament and failed to fix an ailing economy.

After the military's announcement, Morsi was defiant, releasing an audio message to supporters saying that he was the "only legitimate president in Egypt." He also urged non-violence. "Do not fall for calls of bloodshed," he said. "We'll all regret it."

Anti-Morsi protesters, however, were jubilant, recreating the noisy atmosphere that surrounded the ouster of Mubarak in 2011.

In the battle for legitimacy, semantics could matter. The military insisted that what happened was not a coup, and that it was simply facilitating the will of the people.

Morsi, however, called it a "full coup." That echoed a statement made by one of his top aides, Essam al-Haddad, who wrote on Facebook, "For the sake of Egypt and for historical accuracy, let’s call what is happening by its real name: Military coup."

If the international community considers it a coup, it could have serious repercussions for Egypt's economy and U.S. relations with the strategically important country:

Whatever Morsi's ouster should be called, it wasn't bloodless; the protests left 39 people dead and 200 injured.

Here is live footage of the celebrations from Egypt:

Live broadcast by Ustream