Egyptians began an anxious wait for their first freely elected president on Sunday after two days of voting that was to be the culmination of their Arab Spring revolution but which many fear may now only compound political and economic uncertainty.
With polling stations closed at 10 p.m. (9:00 p.m. British time), aides to both candidates in the runoff - Ahmed Shafik, a former general who was prime minister when Hosni Mubarak was overthrown, and Mohamed Morsy, an Islamist from the long suppressed Muslim Brotherhood - were claiming their man seemed to be ahead.
Counting was under way but, in a country unused to free elections, it was unclear how soon any indication of the result would emerge. After a first round of voting last month, which knocked out several popular candidates, it took several hours.
On Monday, the new president, whether Morsy or Shafik, will be told, along with the rest of the country, what powers he will have by the ruling generals. Military and legal sources told Reuters the military council would take back legislative powers for now from a new, Islamist-dominated parliament that it has dissolved following a court ruling voiding an earlier election.
Turnout, only 46 percent in the first round of the presidential vote, appeared to electoral officials to have been no higher for the decisive head-to-head contest. Many of the 50 million eligible voters were dismayed by an unpalatable choice between a man seen as an heir to Mubarak and the nominee of a religious party committed to reversing liberal social traditions. Some cast a ballot against both men in protest.
"I'll cross out both Morsy and Shafik because neither deserve to be president," said Saleh Ashour, 40, a shopkeeper in the middle-class Cairo neighbourhood of Dokki as he went to vote. "I want to make a statement by crossing out the two names.
"Just staying away is too passive."
Shafik, 70, had promised he had heeded the lessons of the revolution 16 months ago and offered security and prosperity. Morsy, 60, tried to widen his appeal beyond the Brotherhood's committed and disciplined base by pledging to preserve a pluralist democracy and finally end a history of military rule.
In the second city, Alexandria, computer engineer Sameh Youssef, 30, was wary of Islamist rule but wanted to honour the dead of an uprising launched by frustrated young urbanites: "I will vote Morsy," he said. "Not because I like him but because I hate Shafik. Between us and Shafik there is blood."
In Old Cairo, however, 56-year-old physician Khalil Nagih echoed the sentiments of many, including Christians like himself, whose mistrust of the Brotherhood and desire for an end to a year of chaos outweighed anxiety about the army's role:
"I chose Shafik because he has experience of administration and was an officer. He is a straight talker and he speaks to all communities. He says he'll solve our problems and I believe him. Morsy will bring a religious state and take Egypt backwards."
Whoever wins, Egypt's political landscape is hazy beyond one clear landmark - the 20 or so senior commanders around Field Marshal Hussein Tantawi, whose Supreme Council of the Armed Forces (SCAF) claimed sovereign power after easing out their brother officer Mubarak to appease the millions on the streets.
In what opponents denounced as "coup", the SCAF dissolved parliament after judges, appointed under Mubarak, ruled on Thursday that a legislative election over the winter breached legal rules and would have to be re-run.
The Brotherhood and hardline Islamist allies dominated the new chamber, and risk losing seats in any new vote, having alienated many outside their core support base. Among failings they are accused of was the inability to form a consensus body to draw up the new constitution Egyptians are hoping for.
As presidential voting was ending, military and legal sources told Reuters that the military council would promulgate an amended constitutional decree on Monday returning to itself the legislative powers it handed to parliament this year.
"In the absence of parliament, legislative powers move back to the military council, which has been in charge of the country and will hand over presidential powers to the president soon," a military source told Reuters.
The decree would also define the new president's powers: "The country's head of state will have the power to appoint a prime minister and cabinet ministers," the military source said.
A lawyer who attended a meeting with the military council on Sunday said: "The presidential powers which the military council held until now will now shift to the new president."
The Brotherhood has rejected the army's power to dissolve parliament and warned of "dangerous days". But though some have compared events to those in Algeria 20 years which ended in civil war between the military and Islamists, many doubt that the Brotherhood has an appetite for violence at present.
Many opponents of military rule have also complained that the Brotherhood has overreached itself in seeking both legislative and presidential power, limiting its broader appeal.
Egyptians massed in their millions against Mubarak in January last year in the hope that his removal would end poverty, corruption and police brutality. Many now seem tired of the social turmoil and political bickering that ensued.
"Egypt writes the closing chapter of the Arab Spring," read a headline on Sunday in independent newspaper al-Watan, which said the election offers a "choice between a military man who aborted the revolution and a Muslim Brother who wasted it".
Monitors said they had seen only minor and scattered breaches of election rules by Sunday morning but not the kind of systematic fraud that tainted elections under Mubarak, despite mutual accusations of irregularities by the rival camps.
A win for Shafik may prompt street protests by the Islamists and some of the disillusioned urban youths who made Cairo's Tahrir Square their battleground last year. Should Morsy prevail, he may be frustrated by an uncooperative military elite, for all the generals' pledges to cede power by July 1.
Egypt's armed forces have built up massive wealth and commercial interests, helped since the 1970s by a close U.S. alliance which followed the decision of the most populous Arab state to make peace with Israel.
Many Egyptians say the army is just one wing of an entrenched security establishment that has resisted reform and oversight since Mubarak left and would wield influence long after the promised handover to an elected civilian.
"There is no doubt that the state in all its institutions - judicial, military, interior, foreign and financial - back Shafik for president and are working to that end," said Hassan Nafaa, a politics professor who campaigned against Mubarak.
"It is very difficult to eradicate this spirit of Mubarak."