CAIRO — A militant group affiliated with the Islamic State said it destroyed an Egyptian naval vessel on Thursday, posting photographs on social media of a missile exploding in a ball of fire as it slammed into the vessel.

An Egyptian military spokesman said that the crew of the unnamed ship “exchanged fire” with militants off the coast of the northern Sinai Peninsula, causing a fire on board that did not result in any fatalities.

But the militant group, which calls itself Sinai Province, claimed that the missile was guided and had killed everyone on board.

It was at least the fourth unusually bold militant assault since late June, when Egypt’s top prosecutor was killed by a car bomb that detonated near his convoy. Each new attack has chipped away at claims by the government to have gained the upper hand over an insurgency that began after the military deposed President Mohamed Morsi of the Muslim Brotherhood in July 2013.