The Interior Ministry, which is in charge of police, gave a much lower death toll, saying that 16 were killed in the shootout.
The ministry said it had sent police to the area, less than 200 kilometres southwest of Cairo, after learning that militants were there "hiding, training, and preparing to carry out terrorist operations".
But, according to a security source, their convoy came under attack by militants using rocket-propelled grenades and explosive devices.
The country has been in a heightened state of turmoil and violence since the military overthrew President Mohammed Morsi of the Muslim Brotherhood, the country's first democratically-elected president, in mid-2013 following mass protests against his rule.
The sources said authorities were following a lead to an apartment thought to house eight suspected members of Hasm, a group which has claimed several attacks around the capital targeting judges and policemen since past year. That attack was claimed by the Islamic State's affiliate, known as Wilayat Sinai, which has been waging a four-year-long insurgency against the government mostly in the northern Sinai.
That group has in the past only carried out mostly small operations since it emerged a year ago. But western diplomats and security officials described the death toll as in the dozens with few militants, if any, being killed.
Most of its leadership has been jailed in a crackdown under Sisi.
Fifteen militants, who were reported to belong to an extremist group called Hasm, also died in the attack.
A fake claim in the name of the small extremist group Hasam, reported by multiple local media, had spread on social media soon after the shootout.
Last Sunday, at least 24 militants and six soldiers were killed in attacks on military outposts in North Sinai, when more than 100 militants repeatedly attacked security outposts south of the border town of Sheikh Zuweid.