The militants attacked a military checkpoint yesterday in the western desert governorate of Al-Wadi Al-Gedid, on the Farafra Oasis Road, more than 500 kilometers from here.
Farafra is Egypt's western most oasis, near the border with Libya.
The guards were killed during an exchange of fire with the unknown gunmen which lead to an explosion in the checkpoint's ammunition storage, Samir said.
He said the attack killed 21 troops and forces later seized and defused two car bombs before they exploded.
The attackers, armed with rocket-propelled grenades, took the checkpoint by surprise, a military source told the state news agency MENA.
The attack, reportedly took place at the time of Iftar (breaking the fast meal in Ramadan), resembling an earlier attack in August 2012 in which 16 soldiers were killed by militants in Sinai.