CAIRO — Egyptian President Mohamed Morsi awarded medals Tuesday to two recently dismissed military chiefs at the presidential palace during a ceremony that left little doubt the generals are stepping aside without protest.

Field Marshal Mohammed Hussein Tantawi, the country’s former military chief, was given the Order of the Nile, the country’s most prestigious honor. The state-run Middle East News Agency reported that the medal was awarded “in appreciation of efforts spent protecting and serving the Egyptian nation.”

Lt. Gen. Sami Anan, who had served as Tantawi’s deputy and as army chief of staff, was given the Order of the Republic. Tantawi and Anan, who were forced to retire Sunday, will serve as presidential advisers.

Morsi ousted Tantawi and Anan in a dramatic and unexpected shake-up of the military leadership. The move appeared to end a power struggle between the president and the military command, a battle that many Egyptians had assumed would last for years. Lt. Gen. Abdel Fattah al-Sissi, formerly the head of military intelligence and a member of the Supreme Council of the Armed Forces, was appointed Tantawi’s successor. Anan was replaced by Maj. Gen. Mohammed al-Assar, also a SCAF member.

According to a member of Egypt’s military who spoke on the condition of anonymity, the acceptance of Morsi’s assertion of control illustrates a willingness by military leaders to cede some of the vast powers they gained following the fall of President Hosni Mubarak in February 2011.

“It did come as a surprise for us, but we accepted this for the sake of the nation’s interests,” said the officer, who was not authorized to speak to the press. “We don’t want to rule. We only want what is best for the country.”

He added that the decisions had drawn wide acceptance within the ranks.

“For us, there has to be change,” he said. “We need new blood and new spirit to be able to work again.”

Some analysts said Tantawi and Anan could have faced criminal charges upon their retirement for actions taken during the Egyptian revolution and the 17 months of military rule that followed. The two military chiefs may have stepped down quietly in exchange for a promise of immunity from prosecution, said Michele Dunne, director of the Atlantic Council’s Rafik Hariri Center for the Middle East.

The awards and the appointments as presidential advisers “could be an indirect signal that these guys are going to be honored, and they’re not going to be prosecuted,” Dunne said.

The leadership changes may have been accelerated by an attack on Egyptian security forces in northern Sinai, analysts said. The Aug. 5 assault on a checkpoint near the Rafah border crossing into the Gaza Strip, not far from the Israeli border, killed 16 Egyptian soldiers. Military and intelligence officials came under intense criticism after the attack, a reaction that made Morsi’s dismissals less controversial.

On Tuesday, a court in Ismailia, on the west bank of the Suez Canal, sentenced 14 Islamist militants to death for killing policemen and soldiers during an attack on a police station in North Sinai in July last year.