(CNN) -- Gunmen killed two Egyptian military personnel and injured a third when security forces raided a militant hideout on Wednesday, the Interior Ministry said.
Two army explosives experts, a general and a colonel, and five members of the Ansar Bayt al-Maqdis were killed in the shootout in Qalyubia province, north of Cairo, the ministry said in a statement posted on its website. Four other members of the group, one of Egypt's most active militant organizations, were wounded, as was a special forces officer.
Intelligence had indicated the group was using a wood manufacturing workshop as a base and to store weapons and ammunition, the Interior Ministry said.
The clashes lasted several hours, the statement added.
Ansar Bayt al-Maqdis, which the United States has designated a terrorist group, has been blamed for attacks in Egypt's Sinai Peninsula as well as on a security forces headquarters in the town of Mansoura last year.
It claimed responsibility in January for four blasts that killed at least six people in and around Cairo.
Islamist militants are expanding their insurgency in Egypt, where army chief Field Marshal Abdel Fattah el-Sisi is expected to announce he will run for president. El-Sisi played a key role in the military overthrow of former President Mohamed Morsy last July.
Militants based in the Sinai Peninsula near the Israeli border have stepped up attacks on soldiers and policemen since Morsy's ouster, which came amid widespread protests against his rule. Morsy and other Muslim Brotherhood leaders were rounded up soon after.
CNN's Marie-Louise Gumuchian contributed to this report.