CAIRO - Egypt's military rulers on Sunday officially recognized Mohammed Morsi of the Muslim Brotherhood as the winner of Egypt's first competitive presidential election, handing the Islamists both a symbolic triumph and a potent weapon in their struggle for power against the country's top generals.
Morsi, 60, an American-trained engineer and former lawmaker, is the first Islamist to be elected as head of an Arab state. He becomes Egypt's fifth president and the first from outside the military. But his victory, 16 months after the military took over on the ouster of Hosni Mubarak, is an ambiguous milestone in Egypt's promised transition to democracy.
Following a week of doubt, delays and fears of a coup after a public count showed Morsi winning, the generals showed a measure of respect for at least some core elements of electoral democracy by accepting the victory of a political opponent over their ally, the former air force general Ahmed Shafiq.
"Today, you are the source of power, as the whole world sees," Morsi said, pointing into the TV camera, during his victory speech.
Morsi's status as president-elect, however, does little to resolve the larger standoff between the generals and the Brotherhood over the institutions of government and the future constitution.
Two weeks before June 30, their promised date to hand over power, the generals instead shut down the democratically elected and Islamist-led parliament; took over its powers to make laws and set budgets; decreed an interim constitution stripping the incoming president of most of his powers; and reimposed martial law by authorizing soldiers to arrest civilians. In the process, the generals gave themselves, in effect, a veto over provisions of a planned permanent constitution.
For much of Sunday, the capital was tense with apprehension that the panel of Mubarak-appointed judges overseeing the election might annul the ballot count and declare Shafiq the president, completing a full military coup. Banks, schools and government offices closed early for fear of violence.
Tens of thousands of Brotherhood supporters and their allies against military rule gathered in Tahrir Square for the sixth day of a sit-in, demanding that the military roll back its power grab. Around 3:30 p.m., hushed crowds gathered around portable radios to hear the election commissioner's rambling introduction of the official result.
Then they leapt to their feet: Morsi had won 51.7 percent of the runoff votes.
"Morsi, Morsi!," the crowd chanted. "Down, down with military rule!"
Smiling riot police put down their helmets to exchange congratulations with bearded protesters. Beaming Brotherhood supporters streamed in, swelling the crowd to perhaps 100,000 by nightfall. In a carnival atmosphere, fireworks were set off and vendors hawked cotton candy or threw pieces of fruit into the laughing crowd.
After 84 years as a secret society struggling in the prisons and shadows of monarchs and dictators, the Brotherhood is now closer than ever to its stated goal of building an Islamist democracy in Egypt.
"In my dreams I wanted this to happen, but it is unbelievable," said Hudaida Hassan, a 20-year-old from Menoufiya.
Brotherhood leaders emphasized that their struggle was far from over. They promised to continue the sit-in and fight on in the courts and the streets to reinstate the parliament. In his short first statement as president-elect, Morsi vowed to take the oath of office before the reseated parliament, and not the Supreme Constitutional Court, as the generals had decreed.
Field Marshal Mohamed Hussein Tantawi, the chairman of the military council, congratulated Morsi.
President Barack Obamacalled Morsi to congratulate him and offer continued U.S. support for Egypt's transition to democracy, the White House said.
Obama "emphasized his interest in working together with President-elect Morsi, on the basis of mutual respect, to advance the many shared interests between Egypt and the United States," the White House said.
The official presidential guard, which once protected Mubarak, arrived at Morsi's home to take up their new role. Until 16 months ago, their appearance at the home of a Brotherhood leader could only mean a trip to one of Mubarak's jails. Morsi himself was jailed for a period in 2008 and again during the revolt last year against Mubarak.
State television, long a wellspring of propaganda against the Brotherhood, broadcast Morsi's victory speech on Sunday. In it, he pledged repeatedly to be "a president for all Egyptians."
"We as Egyptians, Muslims and Christians, are preachers of civilization and building; so we were, and so we will remain, God willing," he said. "We will face together the strife and conspiracies that target our national unity."