Egypt's interim government has pledged "decisive" action and ordered heightened security after armed men killed six soldiers at a Cairo checkpoint.
The shooting on Saturday morning came two days after a soldier was killed in Cairo, as fighters once based in the Sinai Peninsula widen attacks that have surged after the army overthrew President Mohamed Morsi last July.
The government is preparing for a presidential election this spring that will probably be contested and won by army chief Abdel Fattah el-Sisi, the field marshal who overthrew Morsi.
Sisi is expected to resign as defence minister and army chief and announce his candidacy this week, following the interim president's approval of a law to organise the poll.
His supporters see him as the best suited leader to restore stability and law and order amid persistent attacks and street protests by Morsi's mostly Islamist supporters.
In Saturday's attack, masked assailants opened fire on military policemen as they were finishing their morning Muslim prayers and then planted two bombs to target first responders, the military said in a statement.
The Health Ministry said six soldiers were killed.
Major-General Mahmoud Yousri, the chief of security of Qalubiya province, told the state news agency MENA that the attackers stormed the checkpoint early on Saturday in the Shubra al-Kheima suburb.
He also said explosive-disposal experts managed to defuse two bombs left behind by the attackers.
In an emergency meeting that ended early on Sunday morning, the Egyptian cabinet decided to "decisively confront whoever attacks citizens and civilian and government installations", it said in a statement.
It emphasised that attacks on the army would be dealt with by military courts, in accordance with a constitution approved in a referendum in January.
The government also ordered heightened security measures to counter what has become a low-level insurgency that has killed more 200 soldiers and policemen since Morsi's overthrow.
Most of the attacks since have been carried out in the Sinai, but fighters have expanded their reach to the Nile Delta and the capital in recent months.
The government has mostly blamed Morsi's Muslim Brotherhood, which renounced violence decades ago and has denied any involvement.
The most prominent attacks, including a car bombing at a police headquarters in Cairo and the downing of a military helicopter in Sinai, have been claimed by Ansar Beit al-Maqdis (Partisans of Jerusalem), a Sinai-based group.
The group said in a statement on Friday that one of its founders, Tawfiq Mohamed Fareej, died last week when a car accident set off a bomb he was carrying.
Fareej led a 2011 cross-border attack in Israel that killed eight people and was also involved in a failed attempt on the life of Egypt's interior minister, it said.
The group has said the attacks in Egypt are in retaliation for a government crackdown on Morsi's supporters, which Amnesty International says has claimed some 1,400 lives.
Morsi won Egypt's first-ever democratic presidential election, following the 2011 uprising that ended Hosni Mubarak's three-decade rule.
Morsi's year in power bitterly polarised Egyptians, and the military toppled him amid mass protests demanding his overthrow.
Since Mubarak's removal and subsequent arrest, his supporters have staged weekly rallies that often set off deadly clashes with security forces and Morsi opponents.
Meanwhile, the army has poured troops and armour into Sinai to combat the growing insurgency, often targeting suspected armed men with air strikes.
Many say the army campaign has led the fighters in Sinai, some inspired by al-Qaeda, to adapt by staging less frequent but more widespread attacks across the country.
With the Brotherhood decapitated by the crackdown, some of its members might also have decided to form armed cells to target policemen, they say.
Morsi, who is still in jail, faces three separate trials for involvement in the killing of opposition protesters and collusion with armed groups to carry out attacks in Egypt.