The Egyptian president has ordered the powerful head of the army and defence minister, Field Marshal Hussein Tantawi, into retirement and cancelled constitutional amendments issued by the military restricting presidential powers.
Mohamed Morsi announced through a spokesman on Sunday the dismissal of Tantawi and his appointment as a presidential adviser.
According to state television, Abdul-Fatah al-Sessi would replace Tantawi as defence minister and the general commander of the army.
Morsi also sent into retirement the chief of army staff, Sami Anan, and appointed him as a presidential adviser.
Lieutenant-General Sidki Sayed Ahmed was named as Anan's replacement.
Morsi further appointed a senior judge, Mahmoud Mekki, as vice-president. All decisions are effective immediately.
Tantawi was the head of the Supreme Council of the Armed Forces (SCAF), which ruled the country after Hosni Mubarak was toppled as president in February 2011.
He was defence minister for nearly two decades under Mubarak.
Morsi, from the Muslim Brotherhood, and his Islamist allies did not hide their displeasure with the amendments issued by the military in mid-June curtailing the president's role and granting the army massive powers, including legislative control.
Earlier this week, Morsi sacked the head of the intelligence service.
Besides Tantawi and Anan, Morsi also ordered the retirement of the commanders of the navy, air defence and air force.
The retired navy commander, Lieutenant-General Mohan Mameesh, was named as chairman of the Suez Canal, the strategic waterway linking the Red Sea and the Mediterranean and a major source of revenues for the country.
Al Jazeera's correspondent, Sherine Tadros, reporting from Cairo, said the president's spokesperson made the surprising announcement on state television.
"There will be a lot of questions asked, especially if Morsi is able to do this," she said.
"In the coming hours, we will find out how this decision came about. All of this has happened very fast, and it was unexpected."
Source:Al Jazeera and agencies