Egyptian President Mohammed Mursi has driven back the biggest challenge to civilian rule by dismissing a number of top generals.
He has torn up their legal attempt to curb his power in a bold attempt to end 60 years of military leadership.
Mr Mursi pushed also Field Marshal Hussein Tantawi into retirement.
Mr Tantawi took charge of the biggest Arab nation when Hosni Mubarak fell last year and remained head of its powerful, ad hoc military council after Mr Mursi was elected in June.
The armed forces, which had supplied Egypt's presidents for six decades after ousting the monarchy, have shown no sign of challenging the move announced late last night, though a senior judge did question Mr Mursi's right to act.
Lower-ranking generals and other officers may, however, support a change that shifts power in the military to a new generation.
State media cited a military source dismissing talk of any "negative reactions" by the generals to a decision which, given their earlier dissolution of parliament, now hands Mr Mursi what liberal critic Mohamed ElBaradei described as "imperial powers".
As well as ordering the retirement of Mr Tantawi, the head of the Supreme Council of the Armed Forces (SCAF) and Mr Mubarak's defence minister for 20 years, and Chief-of-Staff Sami Enan, 64, Mr Mursi also cancelled a decree issued by the military before his election which had curbed the power of the presidency.
Mr Mursi appointed General Abdel Fattah al-Sisi from military intelligence, to lead the army and become defence minister.
Mr Enan was replaced by General Sidki Sobhi who led the Third Field Army based in Suez, on the border with Sinai.