By Edmund Blair and Yasmine Saleh
CAIRO (Reuters) - A blunder by the Egyptian army that left 16 border guards dead at the hands of Islamist militants gave President Mohamed Mursi an unexpectedly early chance to claw back powers from a military whose political influence he had always wanted to restrict.
A week after the raid on Egypt's Sinai border that outraged ordinary Egyptians and some soldiers, angry at what they saw as a failure in military leadership, Mursi on Sunday dismissed the country's two top generals and tore up an army decree that had curbed his powers.
It was a dramatic move, all the more surprising coming from a man who was the Muslim Brotherhood's last-minute candidate for the presidential election that ended in June, pilloried at the time as a stiff politician seen more as a Brotherhood functionary than a statesman-in-waiting.
Few would label him so now, even if many say he could not have been so audacious without the backing of the Brotherhood, whose top officials long talked of rolling back the military's influence but had spoken of it taking years.
His bold tactics still carry risks, even though the army has so far shown no signs of challenging the move.
There may yet be a backlash from a Mubarak-era establishment, the so-called "deep state", which will take years to reform. In addition, with power concentrated in his hands, Mursi has few others to blame for any failings as he works on the mammoth task of fixing a crippled economy.
Yet his move to reshape the military leadership when it was on the defensive after the Sinai debacle and secure himself more powers to deliver on policy is an early victory, even if more political skirmishes with the army and others may erupt.
"President Mursi has been following closely the border attacks and after that he felt that a change was needed in the security leadership," a presidential source told Reuters, explaining the timing of Sunday's army shake-up.
Mursi ordered out Field Marshal Hussein Tantawi, 76, Mubarak's defense minister for 20 years before he took charge of Egypt when the former president fell. He also dismissed Chief of Staff Sami Enan, 64.
Both were replaced by generals, in their 50s, from the Supreme Council of the Armed Forces that Tantawi had led.
"His decisions were guided by what he saw would serve Egypt best and the sentiments he felt from the troops he visited in Sinai," the presidential source said.
Many Egyptians were angered that militants could have been allowed to gain enough of a foothold in Sinai to stage such a brazen assault that killed the 16 guards on August 5, before stealing vehicles and trying to storm the border with Israel.
Even some soldiers quietly grumbled. "In any decent state the minister of defense would have been sacked over the border killings," said one army major, speaking when the national intelligence chief was replaced last week but before Tantawi was eased out.
The backdrop of public anger and signs of discontent in the ranks offered an ideal chance to change the ageing top brass.
Several more junior officers interviewed by Reuters over the past year said they were tired of a few top officers becoming rich while the vast majority of soldiers struggle. Some spoke of growing malaise in the army and slipping standards.
"Events in Sinai accelerated Mursi's moves. This is what the Brotherhood wanted to do eventually. They ended up doing it a lot earlier than everyone expected," said Shadi Hamid of the Brookings Doha Centre.
Hamid said Mursi may have also been encouraged after winning some public praise for the sacking a few days earlier of the intelligence chief and North Sinai governor. Islamists and, more unusually, some liberals turned up at the presidential palace after that decision with banners saying "Yes to Mursi."
But Hamid said it was "premature" for the Brotherhood to rest on its laurels or to count out the military.
"This was a risky move. It is not all rosy for Mursi. He has to deliver now," he said. "There are certain elements in the deep state that are not happy with a strong, assertive presidency."
For now, the army appears to have accepted the changes. A general promoted in the shake-up and the presidential source insisted Mursi consulted with Tantawi and the military council beforehand, though they did not indicate whether or not the top brass were happy about the decision.
A Facebook page affiliated to the military council carried a statement saying the shift in command was a "natural change in the leadership of the armed forces, transferring responsibility to a new generation".
A senior Brotherhood official said Mursi needed to assume more powers to deliver on economic and other policies, but those had been denied him by the constitutional declaration issued by the military as he was being elected.
"The nation came to have two heads - the president and the military council," Mahmoud Ghozlan, a Brotherhood executive bureau member, told Reuters. "The president had to act to recover his full powers from the hands of the military council."
CALLS FOR PROTESTS
In Sunday's decree, Mursi also revoked the constitutional declaration, taking back for the presidency amongst other things legislative power in the absence of the Islamist-led parliament that the army had dissolved based on a court ruling.
Calls for protests on August 24 by Brotherhood opponents may have been one more reminder to Mursi that he needed to deliver on policy to avoid momentum against his rule building, even if more power gives him fewer excuses for any failures.
"Mursi now holds the executive and legislative power. If he uses it in an improper way this will trigger a lot of political opposition," said political analyst Hassan Nafaa.
Yet, even with the army shorn of the powers it had sought to retain, the military with its vast economic interests and history of influence cannot be ignored by Mursi, and his decree indicated he was still treading with some caution.
Tantawi and Enan were both kept on as "advisers" to the president, dignifying their exit but also suggesting they effectively had presidential protection from prosecution and so would be spared the fate of Mubarak, a former air force commander who was jailed for life after 30 years in power.
"The army remains a massive institution in the life of Egypt. The fact that Mursi felt ... he needed to offer them jobs, gives you an idea of how worried he is about the potential for the backlash from the army," said a Western diplomat.
Yet Tantawi, who had always stayed in the shadows during Mubarak's era and never appeared at ease in the spotlight as interim leader, may also have been ready to step aside, provided he had the right assurances.
"We know from our contacts with him that he is tired," said the diplomat. "He has had enough but he doesn't want to retire in a way that opens him up to prosecution."
Short of a full military coup, the army has had few political channels to challenge Mursi's action after it formally handed over to the elected president on June 30. But the army is not without its allies or routes to press its cause.
The courts, which earlier overruled Mursi's decree to reinstate the dissolved parliament, could still challenge the latest decree too. A member of the Supreme Constitutional Court has already questioned the legality of Mursi's decision.
Mursi has begun to whittle away at the state apparatus that kept autocrats in power for decades. But having proved he won't be a pushover, Mursi now faces the much bigger task of delivering on the policies for which he was elected.
"It is clear now to everyone that Mursi is going to be a strong, assertive president so I think he gotten what he wants in the short term," said Hamid. "Now he has to turn to the economy, now he has to turn to making tangible improvements in people's lives."
(Writing by Edmund Blair; Editing by Giles Elgood)