The Ministry said that the police forces killed and injured 15 terrorists during the clashes.
The statement added that the Interior Ministry's National Security Service received information about the location of risky militants taking shelter in the Western Desert's kilo 135, and then a raid was ordered to be launched. At least 23 police officers were killed and the other victims were conscripts, the sources said.
The police forces received information about a number of terrorists hiding in the desert area.
Hasm is a group that has claimed several attacks around Cairo targeting judges and policemen since past year.
In response to the latest bloodshed Egyptian security forces appeared to step up their operations in the area of the attack.
The exchange of gunfire took place on Friday in the al-Wahat al-Bahriya district in the Giza governorate, about 135 kilometers, from the Egyptian capital.
Interior Ministry said that a number of policemen were killed and injured, and some terrorists also died in the ensuing crossfire.
Hundreds of soldiers and police have been killed in the grinding IS insurgency in the Sinai Peninsula in the far northeast of the country.
He too said eight other security personnel were wounded in the attack.
The government accuses Hasm of being the militant arm of the outlawed Muslim Brotherhood but the organisation denied such accusations.
But, according to a security source, their convoy came under attack by militants using rocket-propelled grenades and explosive devices.
He also called on officials to exert all possible efforts to capture the terrorist elements involved in the shootout.
The country has been under a state of emergency since bombings and suicide attacks targeting minority Coptic Christians killed scores earlier this year.