CAIRO (AP) -- At least 54 policemen, including 20 officers and 34 conscripts, were killed when a raid on a militant hideout southwest of Cairo escalated into an all-out firefight, authorities said Saturday, in one of the single deadliest attacks by militants against Egyptian security forces in recent years.
The officials said the exchange of fire began late Friday in the al-Wahat al-Bahriya area in Giza province, about 135 kilometers (84 miles) southwest of Cairo.
The firefight began when security forces acting on intelligence moved against a militants' hideout in the area. Backed by armored personnel carriers and led by senior counterterrorism officers, the police contingent drew fire and rocket-propelled grenades, according to the officials.
The officials said what happened next is not clear, but indications suggest that the force ran out of ammunition and that the militants captured several policemen and later killed them. One officer managed to escape in his armored vehicle, they added.
The officials said the police force appeared to have fallen into a carefully planned ambush set up by the militants. The death toll could increase, they added, speaking on condition of anonymity because they were not authorized to brief media.
Those killed included two police brigadier-generals, a colonel and 10 lieutenant colonels.
Egypt's Interior Ministry, which is in charge of police, announced a much lower death toll, saying in a statement read over state television that 16 were killed in the shootout. It added that 15 militants were killed or injured.
The last time Egypt's security forces suffered such a heavy loss of life was in July 2015 when militants from the extremist Islamic State group carried out a series of coordinated attacks, including suicide bombings, against army and police positions in the Sinai peninsula, killing at least 50. However, the army said only 17 soldiers and over 100 militants were killed.
An official statement issued Saturday said Friday's incident would be investigated, suggesting that the heavy death toll may have been partially caused by incompetence, intelligence failures or lack of coordination. The officials said prosecutors will look into whether the police's counterterrorism agents failed to inform the military of the operation or include them.
Two audio recordings purportedly by policemen who took part in the operation circulated online late Friday. One policeman, apparently using a two-way radio, was heard in the nearly two-minute recording pleading for help from a higher-ranking officer.
"We are the only ones injured, sir," the policeman said. "We were 10 but three were killed. After their injury, they bled to death, sir."
"They took all the weapons and ammunition," he added, "We are now at the foot of a mountain."
The second recording was purportedly by a policeman warning others. "I can't identify any direction. Only planes can see us. Take care every one," he was heard saying, adding that militants were pursuing them.
The authenticity of the recordings could not be immediately verified.
The heavy loss of life will likely lead to the restructuring and streamlining of the country's counterterrorism effort, the officials said, with better coordination between the police, military and security agencies high on the list of objectives.
It's also likely to be cited by government critics as a vindication of their long-held argument that suppressing freedoms, jailing opponents and cracking down on civil society does not, as the pro-government media insists, help in the war against terror.
No militant group immediately claimed responsibility for the attack, which bore all the hallmarks of the Islamic State group. A local affiliate of the extremist group is spearheading an insurgency whose epicenter is in the Sinai Peninsula, which borders Israel and the Gaza Strip.
The United States condemned the attack in a statement issued by State Department, offering "profound condolences to the families of the deceased and the government and people of Egypt... at this difficult time."
The incident comes a few days after militants staged a brazen daylight attack in the heart of el-Arish, the largest city in the Sinai Peninsula, attacking a church and a nearby bank and reportedly making away with some $1 million. Seven were killed in the Monday attack.
Attacks by militants have significantly increased since the 2013 ouster by the military of an Islamist president, who was freely elected but whose one-year rule proved divisive. Attacks have also spread outside Sinai and into the country's mainland and areas close to the porous Libyan border to the west.
The country has been under a state of emergency since April, following a spate of suicide bombings targeting minority Christians that have killed more than a 100 since December. The attacks were claimed by IS.
Egypt blamed the attacks on the Christians on militant cells trained and armed in neighboring Libya, where mostly Islamist militias, including extremist groups like IS, control territory or maintain a foothold in the vast, oil-rich nation. In response, Egypt has stepped up security along its desert border with Libya, where it supports an eastern-based army general fighting militant groups.
In July 2014, gunmen armed with rocket-propelled grenades attacked a border guard post in Egypt's western desert in a brazen assault that killed 21 troops deployed close to the Libyan border.
Associated Press writer Thomas Strong in Washington D.C. contributed to this report.