The officials identified the victim as Brig-Gen. Adel Ragai, commander of the army's 9th armored division, which is headquartered in the sprawling military base of Dahshour west of Cairo. They said Ragai recently served in the restive north of the Sinai Peninsula, for years now the theater of operations in what has effectively become a war of attrition between security forces and Islamic militants.

The officials spoke on condition of anonymity because they were not authorized to speak to the media.

The cabinet denounced the attack in a statement, quoting Prime Minister Sherif Ismail as saying such attacks only strengthened the resolve of security forces to defeat the militants. The statement did not name the victim.

There was no immediate claim of responsibility for the killing, but the attack bore the hallmarks of the militant Islamic groups fighting security forces in the Sinai Peninsula. It was not immediately clear why Ragai in particular was targeted, but the militants have in the past killed army and police officers.

Hasm, or "Decisiveness," a shadowy group suspected of links to the now-banned Muslim Brotherhood, has claimed responsibility in recent weeks for a series of attacks in Cairo, including a shooting against the country's former mufti, or chief Muslim theologian, and a car bomb against the chief prosecutor's deputy. Both escaped unhurt.

Ragai's home is in the relatively quiet El-Obour suburb that straddles the road between Cairo and the Suez Canal city of Ismailia. The location would have allowed the assailants a better chance of getting away than in the capital's traffic-choked streets.

Saturday's shooting came amid a spike in violence in the turbulent northern part of Sinai, including airstrikes and raids targeting suspected militants' hideouts.

President Abdel-Fattah el-Sissi, himself a career army officer, said in a recent interview that he expected the war in Sinai to continue for a long time and that both sides in the conflict were getting better at fighting each other.

Security forces have fought militants in Sinai for years, but the insurgency grew deadlier after el-Sissi led the military's 2013 ouster of an elected but divisive Islamist president, Mohammed Morsi of the Muslim Brotherhood.

The insurgency is now led by a local affiliate of the extremist Islamic State group.