Egypt's Islamist president ordered the retirement of the defense minister and chief of staff on Sunday and made the boldest move so far to seize back powers that the military stripped from his office right before he took over.

Mohammed Morsi has been locked in a power struggle with the military since he took office on June 30. But after militants killed 16 Egyptian soldiers a week ago at a border post with Israel in Sinai, he has sought more aggressively to assert his authority over the top generals.

He fired the nation's intelligence chief a few days ago and made two highly publicized visits to Sinai in the company of top commanders.

He also chaired several meetings with the military brass and made a point of calling himself the supreme commander of the armed forces in televised speeches.

It was not immediately clear whether Morsi's surprise decisions had the military's blessing. But the appointment of outgoing Defense Minister Field Marshal Hussein Tantawi and Chief of Staff General Sami Annan as presidential advisers and awarding them some of the nation's highest honours suggested they may have agreed, perhaps grudgingly, in advance.

Egypt's official Middle East News Agency, quoting an unnamed military official in a brief report, said late Sunday that Morsi's moves were "deliberated and coordinated" in advance. It said there were no "negative reactions" from within the military.

A few hours after the decisions were announced, Morsi called on Egyptians to rally behind him in the face of the nation's many challenges.

"Today's decisions are not directed at certain persons or meant to embarrass certain institutions. I only had in mind the interest of this nation and its people," he said in a televised speech.

"I want (the armed forces) to dedicate themselves to a mission that is holy to all of us and that is the defense of the nation."

Another crowd of supporters formed outside the presidential palace in Cairo's suburb of Heliopolis. Adding to the sweeping changes in the military leadership, Morsi also ordered the retirement of the commanders of the navy, air defense and air force, but named two of them to senior positions.

He appointed a senior judge, Mahmoud Mekki, as vice president. Mekki is a pro-reform judge who publicly spoke against election fraud during Mubarak's 29-year rule.

If Morsi's decisions go unchallenged, it could mean the end of six decades of de facto military rule since army officers seized power in a coup in 1952. But removing Tantawi and Annan does not necessarily mean that the military, Egypt's most powerful institution, has been defeated or that it would give up decades of perks and prestige without a fight.

Egypt's first civilian president acted at a moment when the military was humiliated over a major security failure in Sinai, the deadliest internal attack on soldiers in modern history.

Several days before the killings, Israel warned that an attack was imminent. The intelligence chief was sacked after it emerged in Egyptian media that he knew of the Israeli warning but did not act.

Sinai has been plunged into lawlessness and the rest of the country has seen a sharp deterioration in security while the military ruled.

Morsi's Muslim Brotherhood, a fundamentalist Islamist group, won both parliamentary and presidential elections in the first free and fair votes in Egypt's modern history. The group had been repressed under Mubarak, who ran a secular state.

The Supreme Council of the Armed Forces (SCAF), which ruled Egypt for 17 months after Mubarak was forced out, stripped the presidency of many of its key powers before it handed the office to Morsi. Tantawi was the head (SCAF) and Annan was number two on the ruling council.

The two men appointed to replace them were also members of the SCAF — something that could indicate either the military's agreement to the shuffle or splits at the highest level of the armed forces.

Lieutenant General Abdel-Fattah el-Sissi replaced Tantawi and Lieutenant General Sidki Sayed Ahmed replaced Annan. They were sworn in shortly after the announcement.

Days before the inauguration, the ruling generals decreed constitutional amendments that gave them the power to legislate after the military dissolved parliament, as well as control over the national budget. It also gave them control over the process of drafting a new constitution.

With Sunday's moves, Morsi restored to his office the powers taken from him, seizing back sole control of the constitution drafting process and the right to issue laws.

He decided that if the 100-member panel currently drafting the document did not finish its work for whatever reason, he will appoint a new one within 15 days and give it three weeks to finish its work.

The draft will then be put to a vote in a national referendum within 30 days. Parliamentary elections will follow if the draft is adopted.

"There was a duality of power," said Saad Emara, a senior Muslim Brotherhood member.

"This had to be settled in favor of one authority. The boat with two captains sinks."

Omar Ashour, a visiting Scholar at the Brookings Doha Center who has interviewed SCAF members over the past year, said Morsi's decisions were negotiated with several of the generals who sat on the military council.

"The military council was not going to last forever," he said.

"It is a critical battle, but this is not final."

With power now concentrated in the hands of the Muslim Brotherhood, some fear Egypt will only move from an authoritarian state to an Islamic state.

"Now the military returns to the barracks and Morsi has absolute powers," said Abdullah el-Sinawi, a prominent political commentator and longtime supporter of the military as the guardian of Egypt's fast-fading secular traditions.

Abdel-Rahman Youssef, a liberal popular TV presenter and a supporter of Morsi, said this is a historic opportunity for political reform in Egypt.

"Egypt is now before a real test — to have a powerful president yet to stop him from being repressive," he said.

While Morsi's Brotherhood is considered to be the country's strongest political group, its base of support remains limited when compared to the respect enjoyed by the military.

There is hardly an Egyptian family that does not include a member in active service or who had military experience.

The military has a vast economic empire that accounts for about 25 per cent of GDP.

But the military has been tainted in the 17 months they ran the country after Mubarak's ouster, with the SCAF accused of mismanaging the transitional period and committing human rights violations.

For now, however, Morsi appeared the victor.

Hours after announcing the shake-up, a confident looking president appeared at an annual religious ceremony to hand monetary awards to young Muslims from Egypt and elsewhere who have learned the Quran, Islam's holy book, by heart.

Mohammed Aboul-Ghar, a founder of the new Egyptian Social Democratic Party — a secular group critical of the military as well as Morsi's Muslim Brotherhood — said the power struggle has now been settled in Morsi's favor.

"The military council was forced out of power and lost its position and this was inevitable," he said.

"In the power struggle, the military council was increasingly weakened because of its decisions" and its failure to secure a more straightforward path to democratic transition, he said.