Muslim Brotherhood candidate Mohammed Mursi became Egypt´s president on Sunday after it was announced he had received 51 percent of the vote in the country´s first free elections.
Farouk Sultan, head of electoral commission, announced that Mursi had beaten former prime minister Ahmed Shafik in the poll.
Sultan said Mursi had received 13,230,130 votes, compared to 12,347,380 for Shafik, offering his congratulations to the Brotherhood candidate.
The result means that Mursi received 51.73 percent of the vote, while Shafik won 48.27 percent.
Mursi will immediately be faced with a series of difficult challenges, including restarting Egypt´s faltering economy and healing divides caused by the polarizing elections.
On Saturday two massive Cairo protests highlighting the duel between Mursi and Shafik.
Thousands of Brotherhood supporters had packed Cairo´s iconic Tahrir Square in anticipation of a victory for their candidate, with hundreds spending the night. "Mursi, Mursi, God is greatest," the protesters chanted.
Across the city, in the Nasr City neighborhood, thousands of Shafik supporters held up pictures of their candidate and of military ruler Field Marshal Hussein Tantawi, chanting "the people and the army are one."
"Down with the rule of the Supreme Guide," protesters shouted, referring to the head of the Muslim Brotherhood.
The result was expected to cause tension in the country and the a huge security plan was in place in the capital to prevent unrest.
The delay in announcing the result of the June 16-17 run-off, initially scheduled for Thursday, had raised suspicions that the outcome of the election was being negotiated rather than counted.
As the Supreme Council of the Armed Forces (SCAF) and the Brotherhood clashed publicly over recent measures that consolidated the army´s power, privately they have been talking behind the scenes, sources told AFP.
On Friday, the SCAF warned it would deal "with utmost firmness and strength" with any attempts to harm public interests.
The Brotherhood, for its part, warned against tampering with the election results, but said it had no intention of instigating violence.
It has rejected a constitutional declaration by the military that strips away any gains made by the Islamist group since the popular uprising which forced Mubarak to stand down in February last year.
The document dissolves the Islamist-led parliament and gives the army a broad say in government policy and control over the new constitution. It was adopted just days after a justice ministry decree granted the army powers of arrest.
Those changes mean that even if Mursi wins the election, the Brotherhood is left with no parliament, no say in the constitution and a powerless president.
"It´s a problem which we are trying to resolve," one Brotherhood official said.
The election had polarized the nation, dividing those who fear a return to the old regime under Shafik´s leadership from others who want to keep religion out of politics and who fear the Brotherhood would stifle personal freedoms.