CAIRO -- Islamist candidate Mohammed Morsi declared victory Monday in Egypt's first free presidential election since Hosni Mubarak's ouster 16 months ago. But the military council that has ruled since the uprising issued an interim constitution just as polls were closing that gave the generals sweeping authority to maintain their grip on power and subordinate the nominal head of state.
Though official results have not yet been announced, the Brotherhood released a tally that showed Morsi of the Muslim Brotherhood took nearly 52 percent of the vote to defeat Mubarak's last Prime Minister Ahmed Shafiq with about 48 percent in a very close race. The count was based on results announced by election officials at individual polling centers, where each campaign has representatives who compile and release the numbers before the formal announcement.
If Morsi's victory is confirmed in the official result, it would be the first victory of an Islamist as head of state in the stunning wave of pro-democracy uprisings that swept the Middle East the past year. But the military's last minute power grab sharpens the possibility of confrontation and more of the turmoil that has beset Egypt since Mubarak's overthrow.
By midday, several hundred flag-waving supporters had gathered at Cairo's Tahrir Square, the birthplace of the uprising, to celebrate.
In a victory speech at his headquarters in the middle of the night, Morsi, 60, clearly sought to assuage the fears of many Egyptians that the Brotherhood will try to impose stricter provisions of Islamic law. He said he seeks "stability, love and brotherhood for the Egyptian civil, national, democratic, constitutional and modern state" and made no mention of Islamic law.
"Thank God, who successfully led us to this blessed revolution. Thank God, who guided the people of Egypt to this correct path, the road of freedom, democracy," the bearded, U.S.-educated engineer declared.
He vowed he would be a "servant" to all Egyptians, "men, women, mothers, sisters ... all political factions, the Muslims, the Christians," and added: "We are not about taking revenge or settling scores. We are all brothers of this nation, we own it together, and we are equal in rights and duties."
Just a few days before the presidential runoff on Saturday and Sunday, the military granted itself broad new powers to arrest civilians and a court packed with judges appointed by Mubarak dissolved the parliament freely elected after the uprising, which was dominated by the Muslim Brotherhood.
The interim constitution announced minutes after the polls closing late Sunday night declared the military rulers the country's lawmakers in lieu of the dissolved parliament, gave them control over the budget and the power to determine who writes the permanent constitution that will define the country's future.
The military was thought to be very concerned about having to submit its budget to civilian oversight under an elected parliament and president because it is estimated to control 20-40 percent of Egypt's economy.
The Brotherhood challenged the military's power grab, saying Sunday it did not recognize the dissolution of parliament. It also rejected the military's right to issue an interim constitution and oversee the drafting of a new one.
That set up a potential power struggle over spheres of authority between Egypt's two strongest forces -- the military and the Brotherhood. The fundamentalist group has campaigned on a platform of bringing Egypt closer to a form of Islamic rule. But the military has positioned itself to block that.
And whether the Brotherhood will push a fight remains an open question. It has reached accommodations with the military in the past.
By the group's count, Morsi took 13.2 million votes, or 51.8 percent, to Shafiq's 48.1 percent, of 25.5 million votes with more than 99 percent of the more than 13,000 poll centers counted. Official final results are not expected until Thursday, and Shafiq's campaign challenged the Brotherhood's victory claim, which was based on the group's own compilation of election officials' returns from nearly all polling centers nationwide. The Brotherhood's early, partial counts proved generally accurate in last month's first round vote.
At Brotherhood campaign headquarters, officials and supporters were ebullient. The group that was banned for most of its 80-year history and repeatedly subjected to crackdowns under Mubarak's rule.
The 18-day uprising was launched by secular, leftist young activists, joined only later by the Brotherhood's leadership as millions took to the street, seeking an end to an authoritarian regime considered hopelessly corrupt.
Morsi, who just before the two days of voting declared he "loves" the military, did not make a show of defiance against the generals. Still, the speaker of the dissolved parliament, Brotherhood member Saad el-Katatni, stood next to him in a sign of the group's insistence the legislature remains in place.
Some in the Brotherhood were ready for a challenge. "Down with military rule," the supporters chanted at the headquarters. The secular revolutionary group April 6, which helped launch the anti-Mubarak uprising, congratulated the Brotherhood on its win.
"The next phase is more difficult. We must all unite against the oppressive rule of the military council," one of its founders, Ahmed Maher, said.
The Shafiq campaign accused the Brotherhood of "deceiving the people" by declaring victory. A campaign spokesman on the independent ONTV channel said counting was still going on with Shafiq slightly ahead so far.
The Arab Spring uprisings have brought greater power to Islamists in countries where longtime authoritarian leaders were toppled - but Morsi would be the first Islamist president. The Islamist Ennahda party won elections in Tunisia for a national assembly and it leads a coalition government, but the president is a leftist. Libya's leadership remains in confusion and there is no president, though Islamists play a strong role, and an Islamist party is part of the coalition government in Yemen under a president who was once ousted leader Ali Abdullah Saleh's deputy.
The big question now is how the Brotherhood and the military will get along with the military still holding powers that can potentially paralyze the new president. Critics often accuse the Brotherhood of being power-hungry and compromising in return for a taste of authority. They cite its understandings with the ruling generals over the past 16 months and deals struck with Mubarak's regime itself.
The Supreme Council of the Armed Forces, the body of top generals headed by Field Marshall Hussein Tantawi, who was Mubarak's defense minister for 20 years, has built a formidable lock on ultimate control in Egypt. Just before the election, the ruling council decreed that military police and intelligence now have the right to arrest civilians for a host of suspected crimes, some as minor as obstructing traffic. Then came Thursday's ruling by the Supreme Constitutional Court dissolving parliament.
According to a copy of the interim constitution obtained by The Associated Press, the generals would be the nation's legislators and control the budget. The president will be able to appoint a Cabinet and approve or reject laws. Notably, the declaration prevents the head of state from changing the makeup of the military council and gives Tantawi powers of commander-in-chief that previously were held by the president.
Under the interim constitution, the ruling generals will also have the power to name the 100-member panel tasked with drafting a new constitution, thus ensuring the new charter would guarantee them a say in key policies such as defense and national security as well as shield their vast economic empire from civilian scrutiny. Parliament had been tasked with putting together the panel.
Under the document, new parliamentary elections will not be held until a new constitution is approved, likely meaning an election in December at the earliest. In the constitution-writing process, the military can object to any articles and the Supreme Constitutional Court -- made up of Mubarak-era appointees -- will have final say over any disputes.
"In freezing the SCAF's current membership in place and giving it such sweeping powers, the provisions really do constitutionalize a military coup," said Nathan Brown, a professor of political science and international affairs at George Washington University.
On Sunday, the Brotherhood's 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. El-Katatni insisted the military could not issue an interim constitution. He also said that a constitution-writing panel that the parliament formed just before the court ruling would meet in the "coming hours" to go ahead with its work.
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 ruling 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.
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 in the uprising.
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.
The prospect that the generals will still hold most power even after their nominal handover of authority to civilians cast a gloomy pall over the presidential runoff, leaving many feeling the vote was essentially meaningless.
"It is as if the revolution never happened," Ayat Maher, a 28-year-old mother of three who voted for Morsi in Cairo's central Abdeen district. "The same people are running the country. The same oppression and the same sense of enslavement. They still hold the keys to everything."
-- AP correspondents Hamza Hendawi and Maggie Michael contributed to this report.