CAIRO (Reuters) - Egypt's first Islamist president, Mohamed Mursi, was sworn in on Saturday, propelling his Muslim Brotherhood into power after 84 years of struggle, although the military remains determined to call the shots.
Immediately after swearing his oath, he said a civil, national, constitutional and modern state was "born today".
The bearded U.S.-trained engineer is Egypt's first non-military president since army officers toppled the king in 1952. For the Brotherhood, banned and repressed under ousted leader Hosni Mubarak, it marks a dramatic reversal of fortunes.
"I swear by Almighty God that I will sincerely protect the republican system and that I will respect the constitution and the rule of law," Mursi told judges at the Supreme Constitutional Court, repeating vows he had uttered the day before to supporters thronging Cairo's Tahrir Square.
"I will look after the interests of the people and protect the independence of the nation and safety of its territory."
Mursi, 60, took his oath in the constitutional court, instead of parliament as is usual, because the court had dissolved the Islamist-led lower house earlier this month amid a raft of measures to ensure enduring military influence.
Mursi had shown his distaste for this by his symbolic oath-taking in Tahrir, crucible of the anti-Mubarak revolt, where he said the people were the only source of power, in a dig at the generals who see themselves as the state's ultimate arbiters.
After the oath-taking, Mursi went to Cairo University to speak at the podium used by U.S. President Barack Obama to reach out to the Islamic world in 2009, early in his term.
An honour guard, artillery salute and the national anthem greeted Mursi on his arrival at the university, where "No SCAF (Supreme Council of the Armed Forces)" was scrawled on a wall.
The audience included women in full Islamic face veils or headscarves, some carrying portraits of dead protesters. There were Christian priests, Muslim clerics and men in suits or traditional robes and head-dresses, some with beards.
The arrival of Egypt's military chief, Field Marshal Hussein Tantawi, provoked extraordinary scenes, with chants of "Down with military rule" countered by applause for Tantawi.
The presiding official then led the crowd in the hall in chants of "The army and people are one hand", although some shouted "Allahu akbar (God is greatest)".
Mursi, in a grey suit and red tie, started his own speech with the same words, saying "God is greatest, above everyone".
Tantawi's SCAF has led Egypt's chaotic and sometimes bloody transition since Mubarak's overthrow, holding elections, but ruling by decree with arbitrary and often contradictory decisions, even as the economy shrinks with millions jobless.
A few dozen pro-military demonstrators blocked a highway in Cairo's Nasser City on Saturday, holding banners reading: "Yes to the constitutional declaration" - referring to an army decree on June 17, the last day of the presidential run-off vote.
The decree clipped presidential powers, denying the head of state his role as supreme commander of the armed forces with the right to decide on war and peace. It also gave the army council legislative powers until a new parliament is elected, as well as veto rights over the writing of a new constitution.
The constitutional court building is next to the plush military hospital where Mubarak was transferred last week from the prison where he had begun a life term for failing to stop police killings of people protesting against his 30-year rule.
Security was relatively light and in contrast to the Mubarak era, police did not block traffic for hours outside the court.
In his Tahrir appearance, Mursi had taken pains to show he is a man close to the people, unlike his lofty predecessor. At one point he opened his jacket to show he wore no body armour. He brushed aside his own security cordon to wave to the crowd.
"There is no power above people power," Mursi said in Tahrir. "Today you are the source of this power."
Addressing the "Muslims and Christians of Egypt", Mursi promised a "civil, nationalist, constitutional state", making no mention of the Brotherhood's dream of creating an Islamic order.
Mursi promised to work for the release of Omar Abdul Rahman, a blind Egyptian militant cleric jailed for life in the United States over a 1993 bomb attack on New York's World Trade Centre.
That seemed to signal an intention to carve out a more independent line towards the United States, which provides $1.3 billion a year in military aid in support of Egypt's 1979 peace treaty with Israel. Mursi has said he will respect his country's international obligations, an oblique reference to the treaty.
Israel has watched the rise of the Brotherhood in Egypt with apprehension since the fall of Mubarak, who staunchly upheld peace with the Jewish state, even if relations were never warm.
The army council, determined to control foreign and defence policy, named a National Defence Council this month in which generals will outnumber civilians represented by Mursi and his future prime minister. Decisions are to be by majority vote.
Tantawi, who served as Mubarak's defence minister for two decades, will formally hand over to Mursi later, fulfilling a pledge to make way for an elected president by July 1.
The ceremony, at the Heikstep base used in Mubarak's era for military trials of Islamist militants, was to be televised.
Egypt remains in political limbo, without a constitution, a lower house of parliament or any clarity about the role of a military establishment anxious to stay in the driving seat.
An assembly that is supposed to write a new constitution has begun work after its predecessor fell apart amid disputes over whether Islamists were over-represented in a country with a 10 percent Christian minority and many secular-minded liberals.
Egypt's 82 million people are more polarised than ever.
Mursi narrowly won a run-off vote against Ahmed Shafik, a former air force chief and Mubarak's last prime minister, but many voters were dismayed at having to choose between an Islamist and a man seen as a remnant of Mubarak's era.
Egypt will find it hard to attract the investment, loans and foreign aid it needs to revive an economy blighted by months of turmoil and uncertainty until political stability returns.
The International Monetary Fund's head, Christine Lagarde, called Mursi to discuss Egypt's economic challenges and how the IMF can best help, an IMF spokeswoman said on Friday.
Lagarde hailed Mursi's election as "an important step forward in Egypt's transition", but the Fund has set no date for a staff visit to discuss a proposed $3.2 billion IMF loan, pending the formation of a new government.
In Tahrir, where demonstrators have camped out for weeks to demand an end to military rule, one man said the protest would go on. "We will not leave until parliament is restored and the president gets all his authorities," said Mahmoud Arafa, 41.
Arafa, a shopkeeper from Shabin al-Kom in the Nile Delta, said he wanted Mursi to fulfil the promises he made for his first 100 days in office. "If he cannot, we will help him."
The Muslim Brotherhood's programme calls for swift measures with an immediate social impact, pledging to get traffic moving, restore security, collect rubbish, and clear bottlenecks in the distribution of subsidised bread, petrol and cooking gas.
"For the first time in my life I feel we have elected a leader through our own free will," said Mustafa Abu Hanafi, 31, a computer engineer, from Mansouria, Giza.
"When someone graduates he's supposed to have a job. I haven't been able to find one. You always needed wasta (connections). Under Mursi this will change ... He's one of us."
Additional reporting by Edmund Blair, Marwa Awad, Patrick Werr and Shaimaa Fayed