Egypt's ruling military council has pledged to hand over power to the newly elected president, hours after the Muslim Brotherhood's candidate claimed victory in the first free election since the overthrow of Hosni Mubarak.
Major-General Mohammed al-Assar, a senior member of the ruling council, said the generals would transfer power in a "grand ceremony" by the end of the month, according to the state news agency. He did not give an exact date.
He said the new president will have the authority to appoint and dismiss the government and that the military council has no intention of taking away any of the president's authorities.
But the military council issued an interim constitution that gave the generals sweeping authority to maintain their grip on power and subordinate the nominal head of state.
Although official results have not yet been announced, the Brotherhood released a tally that showed Mohammed Morsi of the Muslim Brotherhood took nearly 52% of the vote to defeat Mubarak's last Prime Minister Ahmed Shafiq with about 48%.
The count was based on results announced by election officials at individual polling centres, where each campaign has representatives who compile and release the numbers before the formal announcement.
If Mr Morsi's victory is confirmed in the official result expected on Thursday, 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.
Hundreds of flag-waving supporters 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, Mr 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, US-educated engineer declared.
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 late on Sunday 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.