Armed men have killed 21 Egyptian military border guards near the frontier with Libya, highlighting a growing threat from an area that authorities say has become a haven for fighters seeking to topple the Cairo government.
Security officials said on Saturday the assailants were smugglers. But the army spokesman said on his Facebook page that "terrorists" - the term authorities use to describe armed fighters - were behind the attack.
He said a weapons storage facility was blown up by a rocket-propelled grenade in an exchange of fire, killing the soldiers and wounding four others.
The attack took place in Wadi al-Gadid governorate, which borders both Sudan and Libya.
Two smugglers were killed in clashes with the guards, security officials said.
Five Egyptian border guards were killed in a similar attack in the same area a few months ago.
Egyptian President Abdel Fattah el-Sisi has repeatedly expressed concerns about fighters who have capitalised on the chaos in Libya and set up operations along the border.
Security officials say those fighters pay smugglers to transport weapons, including machineguns and rocket-propelled grenades, to comrades in Egypt, which is already facing an insurgency based in the Sinai Peninsula near Israel.
Sinai fighters have stepped up attacks against policemen and soldiers since then-army chief Sisi toppled President Mohamed Morsi of the Muslim Brotherhood last summer and launched a fierce attacks on Islamists.
Hundreds have been killed in shootings and bombings.
Security officials say fighters operating from Libya are trying to forge ties with others in the Sinai, an alliance that could prolong Egypt's instability and scare away investors that are badly needed to help fix the economy.
Tribal smugglers told Reuters news agency they charge up to one million Egyptian pounds ($140,000) to move weapons in 4x4 vehicles along desert routes.
Egypt considered launching a cross-border offensive several months ago in a bid to crush the fighters, according to two Egyptian national security officials.
Security officials say fighters along the Libyan border harbour ambitions similar to the al-Qaeda breakaway group that has seized a large expanse of Iraq: they want to topple Sisi and create a caliphate in Egypt.
Sisi, who has said that armed groups stalking the Middle East pose a threat to everyone, has said Egypt will not allow Libya's turmoil to threaten Egypt's national security.