Evan Vucci, Associated Press
FILE - In this June 29, 2012 file photo, Defense Secretary Leon Panetta, left, accompanied by Joint Chiefs Chairman Gen. Martin Dempsey, gestures during a news conference at the Pentagon. Top Pentagon leaders say have talked by phone with their new Egyptian counterparts and are hoping to continue the longtime military relationship between Washington and Cairo. Egyptian President Mohammed Morsi shook up his nation's military over the weekend, replacing two men who'd had strong working relationships with the Pentagon.

For 17 months after longtime Egyptian strongman Hosni Mubarak was forced out of power, the country was ruled by 19 generals, the Supreme Council of the Armed Forces.

The SCAF was to rule only until a democratically elected civilian government could take over. But, in the way these things so often work, the military rulers discovered they liked wielding power largely unchecked.

Many of them were from the long-outlawed Muslim Brotherhood, including the new president, Mohammed Morsi.

In June, just hours before it became clear that the Brotherhood would win not only the presidency but both houses of parliament, the military council gave itself the power to draft and enact legislation, veto decisions by the panel charged with drafting a new constitution and assumed final say over the military's budget and whether to wage war. As a further step, it dissolved the lower house of parliament.

A raid in the Sinai by Islamic extremists that killed 16 Egyptian soldiers apparently gave Morsi the chance to act, especially when it turned out the Israelis had tipped off a senior member of the Egyptian military.

In the immediate aftermath of the raid, Morsi fired his intelligence chief, the head of the presidential guard and several top Interior ministry officials. Then, in a surprise and bold move Sunday, he fired the defense minister and the military council's chief of staff and retired the chiefs of the air force, air defense and navy.

Perhaps thinking of that old adage, "Hold your friends close, but your enemies closer," Morsi kept the ex-officers on as senior advisers.

The military seemed to accept the changes without protest, and the U.S., which bankrolls Egypt to the tune of $1.5 billion annually, treated the change as business as usual. "We had expected President Morsi at some point to coordinate changes in the military leadership and to name a new team," said a Department of Defense official.

The purge of the recalcitrant senior officers was something Morsi had to do if he didn't want to accept a hollow presidency. He acted quickly and decisively and seems to have gotten away with it — at least, so far.