Mohamed Morsi has been sworn in by Egypt's highest court as the country's first freely elected president, succeeding Hosni Mubarak who was toppled 16 months ago.
He took the oath on Saturday before the Supreme Constitutional Court in their courthouse near the Nile River built to resemble an ancient Egyptian temple.
Morsi became Egypt's fifth head of state since the overthrow of the monarchy some 60 years ago.
Morsi has vowed to reclaim presidential powers stripped from his office by the military council that took over after Mubarak's overthrow.
But by agreeing to take the oath before the court, rather than before parliament as is customary, he is bowing to the military's will in an indication that the contest for power will continue.
"Today is the birthday of the second republic," said one of the judges in a preamble to the ceremony, which was broadcast live by state television.
Morsi had wanted the ceremony to take place in parliament, in keeping with the country's interim constitution, but the ruling military dissolved the Islamist-dominated house earlier this month after a court order.
He pre-empted the court ceremony by swearing himself in at Tahrir Square and warning off generals trying to curb his powers.
Morsi praised Muslims and Christians alike in front of crowds that packed the birthplace of the revolt that overthrew his predecessor Hosni Mubarak last year.
In a rousing speech, he promised dignity and social justice and swore to uphold the constitution and "the republican system", reciting the words of an oath which he will now formally take in front of the supreme constitutional court.
"I will look after the interests of the people and protect the independence of the nation and the safety of its territory," he said and promised to preserve a civil state.
Morsi, who resigned as chairman of the Freedom and Justice Party, the political arm of the Muslim Brotherhood, promised to end torture and discrimination. He also issued several challenges to the Supreme Council of the Armed Forces (SCAF), Egypt's military rulers.
He insisted that "no institution will be above the people," critiquing an army which has sought to shield itself from parliamentary oversight. "You are the source of authority," he told the crowd.
Morsi also vowed to work for the release of civilians arrested by the army since the revolution; more than 12,000 people have been tried by military tribunals since February 2011, according to local human rights groups.
'I don't fear anyone but God'
The symbolic oath was a way for Morsi to defuse a lingering political problem. The president traditionally takes the oath of office before parliament, but the legislature was dissolved earlier this month by a high court ruling.
In response, the ruling SCAF shifted the venue to the court, but Morsi was reluctant to take the oath there, for fear of appearing to support the court's ruling.
Tens of thousands of people packed into Tahrir for the speech [EPA]
The Muslim Brotherhood's Freedom and Justice Party had the largest share of seats in parliament, and has vowed to fight its dissolution.
Much of his speech took a populist tone. He spoke for several minutes from behind a lectern, then stepped away to address the crowd more directly.
At one point, he lifted up his suit jacket to show he was not wearing body armour. "I don't fear my people," he said. "I don't fear anyone but God."
He also spoke briefly about Egypt's foreign relations, promising to improve relations with neighbours in Africa and the Middle East, and to "keep the peace".
"We will never give up the rights of Egyptians abroad," he said. "Respecting the will of the people is the basis of our foreign relations."
The president-elect tried to reassure several groups worried about what a Muslim Brotherhood presidency means for Egypt. He made several mentions of "artists and intellectuals", promising to make Egypt a cultural and artistic leader.
On the other hand, in a remark sure to worry Western leaders, Morsi also promised to work to free Omar Abdel Rahman, the Egyptian cleric currently serving a life sentence in the United States for planning the 1993 attack on the World Trade Center. His pledge was most likely a sop to the Salafi groups which have made Abdel Rahman's release a prominent issue.
Not the end of military rule
Morsi will formally take his oath on Saturday morning, and then travel to Cairo University to deliver an inauguration speech.
He will take office amidst a great deal of political uncertainty. He swore to uphold the constitution, but Egypt still does not have a permanent constitution, only a series of "constitutional declarations" issued by the ruling generals.
Shortly before parliament was dissolved, lawmakers appointed a 100-member assembly to draft a new constitution. That panel, too, may be dissolved by court order, though the administrative court hearing the case says it will not issue a ruling until July.
The generals are keen to portray Saturday's swearing-in ceremony as a formal handover of control to a civilian government. But SCAF will continue to wield a great deal of power, perhaps more than Morsi: The military council will control legislative authority, and the Egyptian budget, until a new parliament is elected later this year.
It is also unclear how much power Morsi will have over the military or Egypt's sprawling security services, which spent decades oppressing the Muslim Brotherhood.