A year and a half after the overthrow of Hosni Mubarak, himself near death if not functionally so already, Egypt finally has a new head of state.

Mohamed Morsi is the new president of Egypt, according to results announced Sunday. Election commission head Farouq Sultan said Morsi won 13.2 million votes out of just over 26 million, giving him about 51.7 per cent of the vote, Al Jazeera reported. His competitor, Ahmed Shafiq, the final prime minister under Hosni Mubarak, received 12.3 million. More than 800,000 ballots were invalidated.

Sultan kept the world waiting for the results, delivering a long speech first defending the commission's independence and integrity amid what he called meddling by unnamed political factions.

Thousands of Muslim Brotherhood supporters burst into cheers on Cairo's Tahrir Square, waving national flags and chanting Allahu Akbar! or God is Great, greeting a dramatic victory. 

This is a testament to the resolve of the Egyptian people to make their voice heard, a Morsi spokesman said.

Shafiq, a former air force commander and Mubarak's last prime minister, offered no immediate reaction. 

The Muslim Brotherhood's Freedom and Justice Party, on Facebook, called the election result a tribute to the martyrs of our revolution. It vowed, We will keep walking on the path.

On Twitter, the Muslim Brotherhood said the battle for democracy and justice hasn't ended, and we will remain in Tahrir.

But hours after his victory was announced, Morsi resigned from the Brotherhood and the Freedom and Justice Party, in an apparent effort to send the message that he will represent all Egyptians, CNN reported.

Despite doubts about how much real power the military would let the presidnet exercise, the vote was a moment in history, Abdul Mawgoud Dardery, a fellow member of the Muslim Brotherhood's Freedom and Justice Party, told CNN.

We've been waiting for it for 7,000 years, he said. For the first time in history we have our own president, elected by us. The power of the people is now in the hands of the president -- and the president has to go and move forward.

Thousands of Muslim Brotherhood supporters gathered in Tahrir Square in Cairo over the past week to show solidarity with Morsi. They had been joined by conservative Salafist Islamist groups and revolutionary youth movements.

Police and armored vehicles were deployed in fears that an outbreak of violence might spread from the square out of displeasure with the announced results, whichever way they went.

The presidential election runoff, which occurred on June 16-17, was a close contest between Morsi, a U.S.-trained engineer and former political prisoner under the Mubarak regime, and Ahmed Shafiq, the former air marshal who was Mubarak's last prime minister as his rule collapsed. He served from late January 2011 until March 2011, backed by the armed forces.

Immediately after the Muslim Brotherhood declared Morsi's victory on June 18, the Supreme Council of the Armed Forces, which has held interim ruling authority over the country since February 2011, delayed the official announcement of the results.

Wild rumors followed, along with suspicions that backroom deals were taking place on concessions and compromises to be made for determining the next leader. The military is supposed to officially relinquish power by June 30. However, it has already made unilateral changes in the constitution to cripple the office of president.

The Egyptian president is no longer the official commander of the armed forces and the military has control over its internal operations and budget. The lower house of the Egyptian Parliament, in which the Brotherhood previously held a majority, was dissolved by the SCAF on June 15. The recent political changes are seen as leaving any president of the country a symbolic figurehead rather than a real holder of power.

Regardless, the highly symbolic Morsi victory is recognition for the greater political influence the Brotherhood now wields over the country. 

An anonymous Egyptian security official told the AP that the minister of the interior, Gen. Mohammed Ibrahim, had told the police on Saturday to confront with firmness, force and decisiveness any attempt to violate peace in Cairo.