CAIRO - Islamist Mohamed Morsy was declared Egypt's first freely elected president on Sunday, sparking joy among his Muslim Brotherhood supporters on the streets who vowed to continue a struggle to take power from the generals who retain ultimate control.
Morsy defeated former general Ahmed Shafik in a run-off last weekend by a convincing 3.5 percentage points, or nearly 900,000 votes, taking 51.7% of the total, officials said, ending a week of disputes over the count which left nerves frayed.
He succeeds Hosni Mubarak, who was overthrown 16 months ago after a popular uprising. The military council which has ruled the biggest Arab nation since then has this month curbed the powers of the presidency, meaning the head of state will have to work closely with the army on a planned democratic constitution.
Brotherhood officials, speaking as supporters turned Cairo's Tahrir Square into a roaring sea of flags and chants of "Allahu akbar!" (God is greatest), said they would press on with protest vigils to demand that the ruling military council cancel this month's dissolution of the Islamist-led parliament and a decree which gave the generals powers that will restrict the president.
"Speak! Have no fear! The military must go!" crowds chanted on Tahrir Square, seat of the Arab Spring revolution which prompted fellow officers to push Mubarak aside to appease the protesters.
There were some isolated scuffles in parts of Cairo between rival groups. Several hundred Shafik supporters in the middle-class suburb of Nasr City chanted "Save Egypt! The Brotherhood will destroy it!", while soldiers tried to keep traffic moving.
Field Marshal Hussein Tantawi, who heads the ruling Supreme Council of the Armed Forces (SCAF), called to congratulate the 60-year-old Morsy on his victory, state television said.
How these two men cooperate will determine Egypt's uncertain path from revolution to democracy and its relations with anxious Arab and Western allies: Tantawi was Mubarak's defense minister for 20 years and has been close to the Pentagon; Morsy, jailed more than once under the old regime, has a doctorate in engineering from the University of Southern California.
"Morsy is the first truly democratically elected president in Egypt," Brotherhood official Yasser Ali told Reuters.
"He has the legitimacy and will sit down with the military council and all the political forces to resolve the outstanding issues over parliament and the constitutional decree and the newly imposed emergency law."
Another official at the movement's headquarters, Gihad Haddad, said demonstrations would also continue to press the army: "The peaceful protests will continue in the squares and across Egypt. The struggle for a new Egypt is just beginning."
Those who voted for Shafik as a bulwark against a religious rule that they fear will mean intolerance and alienation from the West were fearful: businessman Maged Abdel Wadud, 45, who had gathered with others at a hotel hoping to greet a victorious Shafik said: "This is a very bad day for Egypt.
"I am so so upset. I can't imagine this man becoming a president of Egypt. This is the beginning of the end for Egypt."
Western powers, and Israel, have been concerned about the Islamist turn in Egypt. But Washington and Europe, both big aid donors, have also pressed the military to accept democracy, while urging the Brotherhood to respect all Egyptians' rights.
"This is a truly historic moment for Egypt - a triumph over the politics of fear and prejudice," a senior Western diplomat said in Cairo. "Egypt has a civilian, democratically elected president for the first time in its history. The Muslim Brotherhood are far from a perfect organisation, but Morsy's election represents a genuine result for the revolution."
He said he did not expect the movement to push its complaints so far as to provoke the military council to react and take from the presidency those powers it still has:
"The Muslim Brotherhood will take what they've got - a prize unimaginable to them 18 months ago," the diplomat said. "An imperfect presidency is way better than none at all.
"It's part of the new and delicate act of political compromise, part of Egypt's new cohabitation."
Liberals remain cautious
Half of those who voted in last month's first round of the election backed neither Morsy nor Shafik and many who voted in the run-off voted negatively - either against Morsy's religious agenda or against Shafik as a symbol of military rule.
For Morsy, a US-educated engineer who spent time in jail under Mubarak, a spokesman said: "This is a testament to the resolve of the Egyptian people to make their voice heard."
Shafik, a former air force commander and Mubarak's last prime minister, offered no immediate reaction. He has said he would offer to serve in a Morsy administration.
Morsy won the first round ballot in May with a little under a quarter of the vote. He has pledged to form an inclusive government to appeal to the many Egyptians, including a large Christian minority, who are anxious over religious rule.
"President Morsy will struggle to control the levers of state," Elijah Zarwan, senior policy fellow at the European Council on Foreign Relations, said in Cairo.
"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," Zarwan told Reuters. "This would be a mistake.
"His challenge is to lead a bitterly divided, fearful, and angry population toward a peaceful democratic outcome, without becoming a reviled scapegoat for continued military rule."
Morsy has promised a moderate Islamist agenda to steer Egypt into a new democratic era where autocracy will be replaced by transparent government that respects human rights and revives the fortunes of a powerful Arab state long in decline. Morsy is promising an "Egyptian renaissance with an Islamic foundation".
Yet the stocky, bespectacled party official appears something of an accidental president: he was only flung into the race at the last moment by the disqualification on a technicality of Khairat al-Shater, the group's preferred choice.
With a stiff and formal style, Morsy cast himself as a reluctant latecomer to the race, who cited religious fear of judgement day as one of his reasons for running. He struggled to shake off his label as the Brotherhood's "spare tyre".
Questions remain over the extent to which Morsy will operate independently of other Brotherhood leaders once in office: his manifesto was drawn up by the group's policymakers. The role Shater might play has been one focus of debate in Egypt.
"I will treat everyone equally and be a servant of the Egyptian people," Morsy said at his campaign headquarters in Cairo shortly after polling ended last Sunday.
But many Egyptians, not least the Christian minority, remain suspicious of Morsy and even more so of the group he represents. Anti-Brotherhood sentiment, fuelled by both a hostile media and some of the group's policies, has soared in recent weeks.
Turnout was only 51.8 percent of the 50 million-strong electorate, slightly up on the first round but indicative still of a nation unused to having its voice heard without risking punishment and uncertain of the worth of the candidates.
Jpost.com staff contributed to this report