Egypt elections
Supporters of Muslim Brotherhood's presidential candidate Mohamed Morsy celebrate his victory at the election at Tahrir Square in Cairo Reuters

In the much-awaited Egyptian presidential race, Muslim Brotherhood's Mohammed Mursi has won making him the first-ever elected president in Egyptian history.

Mursi won about 51 percent of the votes while his opponent and former dictator Hosni Mubarak's ex-aide won about 49 percent of the votes, according to the Election Commission. Close to 3 percent of the votes turned out to be invalid.

According to the count, Mursi won 13,230,131 (51.7 percent) while Shafiq secured 12,347,380 (48 percent) votes.

"This is a testament to the resolve of the Egyptian people to make their voice heard," Mursi's spokesperson was quoted by Reuters.

There is no official reaction from Shafiq yet.

Supporters of Brotherhood were jumping in joy in the capital Cairo where they had already gathered for mass protests against the ruling military.

The election results were delayed by the ruling Supreme Council of the Armed Forces (SCAF) leading to rising tension among supporters of both the sides.

"The commission applied the law when it looked into the ballots. There is nothing above the law," said the head of the panel of judges Farouq Sultan. Sultan also acknowledged that the presidential elections have been marred by tension and a bad atmosphere.

More than the 400 allegations of malpractice during the voting were also upheld by the Election Commission.

Mursi will face a mammoth task to bring political and economic stability to the most populous nation in the Arab world.

"President Mursi will struggle to control the levers of state. He will likely face foot-dragging and perhaps outright attempts to undermine his initiatives from key institutions. Faced with such resistance, frustration may tempt him to fall into the trap of attempting to throw his new weight around. This would be a mistake," says Elijah Zarwan, a senior fellow at the European Council on Foreign Relations in Cairo, reported Reuters.

The Brotherhood is likely to protest against the ruling SCAF to fight against its recent declaration of sweeping powers for itself.

For a long time, critics have been accusing the SCAF of trying to install a proxy president and rule the country through him.

Days before the voting, the Supreme Court also dissolved parliament which angered the Brotherhood.

Fear also existed that the election results could turn awry which may lead to violence among supporters of Mursi and Shafiq.