Mohammed Mursi has been sworn in as Egypt's first civilian, democratically elected president at a historic ceremony in Cairo.
Hours after the ceremony, he was saluted by Field Marshal Hussein Tantawi, leader of the military council which is handing over power.
Mr Mursi has promised to restore the parliament dissolved by the military.
In a speech at Cairo University, the Muslim Brotherhood politician said the army must respect the people's will.
He will have to sort out a very difficult relationship with an entrenched military, regional analyst Magdi Abdelhadi says.
The regime of former President Hosni Mubarak is still largely intact and many in it will not work with the new president, he adds.
Overthrown in February last year after mass pro-democracy demonstrations, Mubarak was sentenced to life imprisonment at the beginning of this month for failing to prevent the killing of protesters by the security forces.
Egypt, the biggest Arab nation, is a key US ally in the region, as well as one of the few states in the Arab world to maintain diplomatic relations with Israel.
Parliament was dissolved by Field Marshal Tantawi's Supreme Council of the Armed Forces (Scaf), which assumed legislative powers under a controversial "interim constitutional declaration".
But on Saturday Scaf handed over power to Mr Mursi after a military parade at the Hykestep military base on the outskirts of Cairo.
"We have fulfilled our promise which we made before God and the people," Field Marshal Tantawi said at the hand-over ceremony.
"We now have an elected president, who assumed Egypt's rule through a free and direct vote reflecting the will of Egyptians."
The field marshal, who saluted Mr Mursi and shook hands with him several times, decorated the new president with the Shield of the Armed Forces, the country's highest honour.
In his speech earlier at Cairo University, Mr Mursi said: "The army is now returning to its original role, protecting the nation and its borders."
'Servant of the people'
Parliament, the new president insisted in his speech, had been elected in a free and fair ballot and had been entrusted with drafting a new, democratic constitution.
He hailed those killed in the uprising against President Mubarak. Families of some of the dead were in the hall and they held up photos of their sons and daughters.
He vowed to raise Egypt to the rank of a modern state "where the president is the servant of his people".
Mr Mursi was sworn in at the supreme constitutional court.
The Egyptian people, he said, had "laid the foundations for a new life, for full freedom, a genuine democracy, for putting the meaning and significance of the constitution and stability above everything else".
His government would be based on the democratic pillars of "the constitutional court, the Egyptian judiciary, and the executive and legislative powers".
The oath of office had originally been scheduled to take place at the parliament, which is dominated by the Muslim Brotherhood-backed Freedom and Justice Party and other Islamists.
Mr Mursi said he was determined that the constitutional court, which had declared November's parliamentary election to be flawed, would remain "independent, strong, effective - away from any suspicion and abuse".
On Friday, Mr Mursi performed prayers at Cairo's al-Azhar mosque, one of the most prominent seats of learning in Sunni Islam.
He has sought to allay fears among some secular and Coptic Christian Egyptians that he will use his presidency to impose Islamic law.
Mr Mursi's campaign has said he plans to appoint a woman and a Coptic Christian as his vice-presidents.
In his speech at Cairo University, he said all Egyptians would be equal before the law.