Relatives of an Egyptian soldier mourn during Tuesday's funeral of one of 16 soldiers killed in an attack over the weekend by suspected militants in Sinai in Cairo, Egypt. After decades of neglect and with the collapse of government authority the past 18 months, Egypt’s Sinai Peninsula has become fertile ground for Islamic extremists. (ASSOCIATED PRESS / Amr Nabil, File)

CAIRO (AP) — Egypt’s president fired his intelligence chief on Wednesday for failing to act on an Israeli warning of an imminent attack days before militants stormed a border post in the Sinai Peninsula and killed 16 soldiers.

The dismissal, which followed Egyptian airstrikes against Sinai militants, also marked a bold attempt by the Islamist leader to deflect popular anger over the attack. It pointed to a surprising level of cooperation with the powerful military leaders who stripped the presidency of significant powers just before President Mohammed Morsi took office June 30.

In a major shake-up, Morsi also asked Defense Minister Hussein Tantawi to replace the commander of the military police, a force that has been heavily used to combat street protests since the ouster of Hosni Mubarak 18 months ago. Rights activists have accused the military police of brutality against protesters.

Morsi also fired the commander of his presidential guards and ordered new chiefs for security in Cairo and the police’s central security, a large, paramilitary force often deployed to deal with riots.

The decisions were announced hours after Egyptian attack helicopters fired missiles at militants in Sinai as part of what the military said was the start of an offensive, to “restore stability and regain control” over the desert territory bordering Israel and the Gaza Strip. The use of air power marked a sharp escalation in Egypt’s fight against the militants, who have become increasingly active in the mountainous terrain since last year’s uprising.

The military said the joint ground operation with police was backed by warplanes.

The start of the Sinai campaign won swift praise from Egypt’s most powerful ally, the United States. White House Press Secretary Jay Carney commended the Egyptians for showing a “willingness to take action when necessary.”

State Department spokesman Patrick Ventrell said the U.S. supports Egypt’s efforts to bring the perpetrators of Sunday’s attack to justice.

“The United States supports the Egyptian government’s ongoing efforts to protect its people and others in the region from terrorism and growing lawlessness in the Sinai,” he said.

Morsi’s firing of senior officials was his first major assertion of authority since he succeeded Mubarak, who ruled Egypt for 29 years.

The generals who took over from Mubarak and ruled Egypt for 17 months made a major power grab just before Morsi took office, retaining many key powers for themselves including the right to legislate and control over the national budget.

The firings followed a meeting of the newly created National Defense Council, which includes Morsi, top army commanders and senior intelligence officials. The decision-making at that meeting reflected a level of cooperation between the president, a longtime leader of the Muslim Brotherhood, and the military leaders in the face of rising tensions over the deadliest attack ever on the military from within Egypt.

Military officers outnumber civilians on the newly created council, which takes decisions by a simple majority. That means that the generals were on board.

“The decisions are consensual and it seems that the interests (of Morsi and the military) have converged on this,” said political analyst Ammar Ali Hassan. “It was in the interest of the presidency and the generals to find a scapegoat.”

Still the cooperation was not seen as the end of Morsi’s struggle with the military to get back the full powers of the presidency. The military may have agreed because it faced accusations of negligence in the media over the attack. Witnesses said security forces arrived at the scene a full hour after it took place and that no soldiers were on sentry duty outside the small post at the time of the attack.

Morsi’s decisions won him praise from political factions outside his Muslim Brotherhood support base.

“The Egyptian people and the revolutionaries wait for more purging of failing officials,” said Ahmed Maher, a founding member of the April 6 movement, one of the key pro-democracy groups behind the uprising last year that forced Hosni Mubarak to step down.

Aboul-Ela Maadi, leader of the Islamist Wasat party, defended Morsi against critics who blamed him for the attack.

“This is the beginning of the president assuming his duties and exercising his authority as president,” he said.

But prominent rights activist Hossam Bahgat said the decisions did not go far enough to clarify the relationship between Morsi and the military.

“It doesn’t go as far as establishing full civilian democratic control over the military,” he said. “But it indicates that the military accepts that Morsi is the new head of Egypt. This however is not guaranteed to last. It is going to take time for the new political order to become clear.”

The soldiers killed in the attack were guarding a post in Sinai close to where the Egyptian, Israel and Gaza borders meet. It raised questions about the readiness of Egyptian forces in the area, particularly after Israel warned the country several days earlier an attack was imminent.

Large swathes of northern Sinai have plunged into lawlessness following Mubarak’s ouster, with a massive flow of arms smuggled from Libya finding their way into the hands of disgruntled Bedouins. The lawlessness is coupled with the rise there of al-Qaida-inspired militant groups that are waging a campaign of violence against Egyptian security forces. They have also staged several cross-border attacks on Israel.

The attackers killed the soldiers as they were breaking their daily fast for the holy month of Ramadan with a sunset meal. They commandeered an armored vehicle which they later used to storm across the border into Israel. They were then targeted by an Israeli airstrike that killed at least six militants.

The intelligence chief that Morsi fired, Murad Muwafi, was quoted in Wednesday’s newspapers as saying his agency was aware of the Israeli warning but did not think that Muslims would attack Muslims while they were breaking their fast during Ramadan.

Muwafi, 61, took over the intelligence post after his predecessor, the enigmatic and secretive Omar Suleiman, was named vice president in the final days of Mubarak’s rule. He served as military intelligence chief before that and governor of Northern Sinai. In his last public appearance, he sat grim faced at a meeting with Morsi and Tantawi immediately after the attack.

His replacement, Mohammed Rafaat Shehata, is a career intelligence officer with a focus on Israeli-Palestinian affairs and relations with Hamas, the Islamic militant group that rules Gaza.

Morsi surprised many Egyptians by staying away from the state funeral given to the slain troops on Tuesday, drawing harsh criticism in the media and on social networks.

He may have stayed away for security concerns. At the funeral secured by military police, some mourners chanted slogans against Morsi. Prime Minister Hesham Kandil was heckled and some threw their shoes at him or held them up as a sign of contempt.

Morsi’s order that the military police commander be replaced along with the chief of the capital’s security was apparently linked to their failure to ensure his safety which forced him to stay away from the funeral and the humiliation of his prime minister, who had to flee to a nearby mosque.