At least 54 police officers have been killed during a raid on a militant hideout in one of the deadliest firefights involving Egyptian security forces in recent years.

Officials said that the gun battle began late on Friday in the al-Wahat al-Bahriya area in Giza province, about 84 miles south-west of Cairo.

Security forces acting on intelligence were moving against a militants’ hideout in the area. Backed by armoured personnel carriers and led by senior counter-terrorism officers, the police contingent drew fire and rocket-propelled grenades, according to the officials.

They said what happened next is not clear, but added that the force likely ran out of ammunition and that the militants captured several policemen and later killed them.

The officials said the police force appeared to have fallen into a carefully planned ambush set up by the militants, and warned the death toll could increase.

Those killed – 20 officers and 34 conscripts – included two police brigadier-generals, a colonel and 10 lieutenant-colonels.

Egypt’s interior ministry 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, later releasing photos of some of them.

The last time Egypt’s security forces suffered such a heavy loss of life was in July 2015 when Isis 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 more than 100 militants were killed.

Egyptian security forces rest on top of an armoured vehicle near the site of the attack (AFP/Getty Images)

An official statement issued on Saturday said the latest 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 counter-terrorism 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 on Friday. One police officer, 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 an officer warning others. “I can’t identify any direction. Only planes can see us. Take care everyone,” 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 counter-terrorism effort, 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.

Russian passenger plane crashes in Egypt Show all 20 1 /20 Russian passenger plane crashes in Egypt Russian passenger plane crashes in Egypt Egyptian soldiers collect personal belongings of plane crash victims at the crash site of a passenger plane bound for St. Petersburg in Russia that crashed in Hassana, Egypt's Sinai Peninsula Russian passenger plane crashes in Egypt Egyptian soldiers collect personal belongings of plane crash victims at the crash site of a passenger plane bound for St. Petersburg in Russia that crashed in Hassana, Egypt's Sinai Peninsula Russian passenger plane crashes in Egypt In this Russian Emergency Situations Ministry photo, made available on Monday, Nov. 2, 2015, showing Metrojet Airbus A321-200 flight 7K9268 flight recorder on display at an undisclosed location in Egypt Russian passenger plane crashes in Egypt Mourners lay flowers at Pulkovo International Airport outside St. Petersburg. Russia on 1 November mourned its biggest ever air disaster after a passenger jet full of Russian tourists crashed in Egypt's Sinai, killing all 224 people on board. Flags were at half mast on the parliament building, in the Kremlin, and on other official buildings in honour of the victims, most of whom were from Russia's second-largest city of Saint Petersburg Russian passenger plane crashes in Egypt People pay their respects at the entrance of Pulkovo airport outside St. Petersburg, during a day of national mourning for the plane crash victims Russian passenger plane crashes in Egypt Debris from the plane crash in Egypt Russian passenger plane crashes in Egypt A piece of an engine of Russian MetroJet Airbus A321 at the site of the crash in Sinai, Russian passenger plane crashes in Egypt The crash site debris Flight 7K9268 crashed in the Sinai peninsula, in all probability killing every one of the 224 people on board AFP/Getty Russian passenger plane crashes in Egypt The crash site debris Debris lies strewn across the sand at the crash site EPA Russian passenger plane crashes in Egypt Relatives in St Petersburg Relatives react after a Russian airliner with 217 passengers and seven crew aboard crashed, as people gather at the Kogalymaviaís information desk at Pulkovo airport in St Petersburg on 31 October AP Russian passenger plane crashes in Egypt Relatives in St Petersburg A relative of a passenger of MetroJet Airbus A321 at Pulkovo II international airport in St Petersburg, Russia, 31 October 2015. EPA Russian passenger plane crashes in Egypt The plane's journey The plane's last recorded radar position above the northern Sinai peninsula Flightradar24 Russian passenger plane crashes in Egypt Where it crashed A satellite view from Google Maps of the rough area where the plane crashed, in the mountainous Hassana region of the Sinai peninsula. Google Maps Russian passenger plane crashes in Egypt The plane The Metrojet's Airbus A-321 with registration number EI-ETJ that crashed in Egypt's Sinai peninsula REUTERS/Kim Philipp Piskol Russian passenger plane crashes in Egypt The plane The crashed Airbus A321 at Domodedovo international airport, outside Moscow,, on 20 October Russian passenger plane crashes in Egypt Relatives at in St Petersburg A relative of a passenger on MetroJet Airbus A321 at Pulkovo II international airport in St Petersburg EPA Russian passenger plane crashes in Egypt Relatives at in St Petersburg Relatives of passengers of MetroJet Airbus A321 at the Crown Plaza hotel in St Petersburg EPA Russian passenger plane crashes in Egypt Bodies being repatriated An Egyptian soldier prays as emergency workers prepare to unload bodies of victims from a police helicopter to ambulances at Kabrit military airport on 31 October. AP Russian passenger plane crashes in Egypt Bodies being repatriated Ambulances line up as emergency workers unload bodies at Kabrit military airport, 20 miles north of Suez, on Saturday AP Russian passenger plane crashes in Egypt Bodies being repatriated Egyptian paramedics load the corpses of victims into a military plane at Kabrit military air base by the Suez Canal on October 31, 2015 AFP/Getty Images

No militant group immediately claimed responsibility for the attack, which bore all the hallmarks of Isis and could also have been launched by the Islamist Hasm Movement.

Isis’s Sinai province affiliate is spearheading an insurgency based in the peninsula, which borders Israel and the Gaza Strip.

The US condemned the attack, in a statement issued by its 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 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 $1m. Seven were killed in the assault last Monday.

Attacks by militants have significantly increased since the 2013 coup that ousted Islamist president Mohamed Morsi, 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 people since December. The attacks were claimed by Isis.

Egypt blamed the attacks on the Christians on militant cells trained and armed in neighbouring Libya. In response, Egypt has stepped up security along its desert border, where it supports rival Libyan leader Khalifa Haftar.