The Muslim Brotherhood declared that its candidate, Mohammed Morsi, won Egypt's presidential election, even as the military handed themselves the lion's share of power over the new president, enshrining their hold on the state and sharpening the possibility of confrontation with the Islamists.
With parliament dissolved and martial law effectively in force, the generals made themselves the country's lawmakers, gave themselves control over the budget and will determine who writes the permanent constitution that will define the country's future.
But as they claimed victory over Hosni Mubarak's last prime minister Ahmed Shafiq in the election, the Brotherhood challenged the military's power grab. The group warned that it did not recognize the dissolution of parliament or the military's interim constitution or its right to oversee the drafting of a new one.
That pointed to a potential struggle over spheres of authority between Egypt's two strongest forces. The Brotherhood has campaigned on a platform of bringing Egypt closer to a form of Islamic rule, but the military's grip puts it in a position to block that. Instead any conflict would likely centre on more basic questions of power.
At a pre-dawn press conference declaring their win, officials from the fundamentalist group that was banned for decades and repeatedly subjected to crackdowns under Mubarak's rule were ebullient and smiling, as supporters chanted, "Down with military rule."
"Thank God who guided the people of Egypt to this right path, the path of freedom and democracy," Morsi told the crowd at his campaign headquarters in his first appearance since the victory claim.
Final official results are not expected until later this week. The Brotherhood's declaration was based on results announced by election officials at individual counting centres, where each campaign has representatives who compile the numbers and make them public before the formal announcement. The Brotherhood's early, partial counts proved generally accurate in last month's first round vote.
The group said Morsi took 51.8 per cent of the vote to Shafiq's 48.1 per cent out of 24.6 million votes cast, with 98 per cent of the more than 13,000 poll centres counted.
Morsi "is the first civilian, popularly elected Egyptian president," the group proclaimed on its website. There was no immediate comment from the Shafiq campaign.
The question now will be how a Brotherhood president will get along with the military generals who have ruled since Mubarak fell on Feb. 11, 2011 and who will still hold powers that can potentially paralyze Morsi. The Brotherhood has reached accommodations with the generals at times over the past 16 months, as it struck deals with Mubarak's regime itself gaining it a reputation among critics as willing to sell out for a taste of authority.
But after a highly polarized presidential election and the miltary's arrogation of powers to itself, the Brotherhood presented itself as willing to get into a confrontation with the Supreme Council of the Armed Forces, the body of top generals headed by Field Marshall Hussein Tantawi, Mubarak's defence minister for 20 years.
Just before the election, the Supreme Council of the Armed Forces, which has ruled since Mubarak's fall, slapped de facto martial law on the country, giving military police and intelligence agents the right to arrest civilians for a host of suspected crimes, some as secondary as obstructing traffic. Then came Thursday's ruling by the Supreme Constitutional Court dissolving parliament, followed by the interim constitution declaration just after polls closed Sunday following two days of voting.
According to a copy of the document obtained by The Associated Press, the generals would be the nation's legislators and control the budget. They also will name the 100-member panel tasked with drafting a new constitution, thus ensuring the new charter would guarantee them a say in key policies like defence and national security as well as shield their vast economic empire from civilian scrutiny.
The president will be able to appoint a Cabinet and approve or reject laws.
Under the document, new parliament elections will not be held until a new constitution is approved, meaning an election in December at the earliest. In the constitution-writing process, the military can object over any articles and the Supreme Constitutional Court which is made up of Mubarak-era appointees will have final say over any disputes.
Earlier Sunday, the Brotherhood's speaker of parliament Saad el-Katatni met with the deputy head of the military council, Chief of Staff Gen. Sami Anan and told him the group does not recognize the dissolution of parliament, according to a Brotherhood statement that pointedly referred to el-Katatni by his title.
El-Katatni insisted the military could not issue an interim constitution and that the constituent assembly formed last week would meet in the "coming hours" to go ahead with its work in writing the permanent charter.
Still, the Brotherhood has no power to force recognition of the parliament-created constituent assembly, which already seems discounted after parliament's dissolution and is likely to be formally disbanded by a pending court ruling. Lawmakers are literally locked out of parliament, which is ringed by troops.
The generals, mostly in their 60s and 70s, owe their ranks to the patronage of Mubarak. All along, activists from the pro-democracy youth groups that engineered the anti-Mubarak uprising questioned the generals' will to hand over power, arguing that after 60 years of direct or behind-the-scenes domination, the military was unlikely to voluntarily relinquish its perks.
The presidential race was a bitter one.
Shafiq, a former air force commander and an admirer and longtime friend of Mubarak, was seen by opponents as an extension of the old regime that millions sought to uproot when they staged a stunning uprising that toppled the man who ruled Egypt for three decades.
Morsi's opponents, in turn, feared that if he wins, the Brotherhood will take over the nation and turn it into an Islamic state, curbing freedoms and consigning minority Christians and women to second-class citizens.
Trying to rally the public in the last hours of voting, the Brotherhood presented a Morsi presidency as the last hope to prevent total control by the military council of Mubarak-era generals.
"We got rid of one devil and got 19," said Mohammed Kanouna, referring to Mubarak and the members of the military council as he voted for Morsi after night fell in Cairo's Dar el-Salam slum. "We have to let them know there is a will of the people above their will."
But the prospect that the generals will still hold most power even after their nominal handover of authority to civilians by July 1 has deepened the gloom, leaving some feeling the vote was essentially meaningless.
"Things have not changed at all. It is as if the revolution never happened," Ayat Maher, a 28-year-old mother of three, said as she waited for her husband to vote in Cairo's central Abdeen district. She said she voted for Morsi, but did not think there was much hope for him.
"The same people are running the country. The same oppression and the same sense of enslavement. They still hold the keys to everything."