At least 13 Egyptian policemen were killed in the Sinai Peninsula when Islamist militants fired a mortar round at a security checkpoint in the city of Arish, security and medical sources said on Saturday.
Islamic State claimed responsibility on several websites for the attack, and Egyptian state media later confirmed it.
Ambulances were subjected to heavy gunfire as they attempted to reach the wounded, the sources said. Eyewitnesses reported hearing a massive explosion and said the city's entrances and exits had been closed off by security forces.
Security sources said government forces were later able to kill five of the militants who carried out the attack.
Egypt is battling an insurgency that gained pace after its military overthrew President Mohamed Mursi of the Muslim Brotherhood, Egypt's oldest Islamist movement, in mid-2013 following mass protests against his rule.
The insurgency, mounted by Islamic State's Egyptian branch Sinai Province, has killed hundreds of soldiers and police and started to attack Western targets within the country.
President Abdel Fattah al-Sisi, the former military chief who led Mursi's ouster, describes Islamist militancy as an existential threat to Egypt, an ally of the United States. Islamic State controls large parts of Iraq and Syria and has a presence in Libya, which borders Egypt.