An Islamic State affiliate has said it fired a rocket at an Egyptian naval vessel in the Mediterranean Sea near the coast of Israel and the Gaza Strip.

Photographs distributed online on Thursday by the militant group Sinai Province appear to show a rocket heading towards a ship and setting it on fire on impact. The militants’ version of events could not be verified.

Egypt’s military said a coastguard launch had exchanged shots with “terrorist elements”, causing the vessel to catch fire, but there was no loss of life.

Such incidents at sea are rare, but Egypt is battling an increasingly brazen Islamist insurgency in the Sinai peninsula, which lies between Israel, the Gaza Strip and the Suez canal.

Sinai Province, the most lethal militant group in Egypt, last year pledged loyalty to Isis, which controls large tracts of territory in Syria and Iraq and has a presence in Egypt’s neighbour Libya.

It has recently carried out high-profile attacks which prompted the drafting of a sweeping counter-terrorism law.

The authorities said 100 militants and at least 17 security personnel were killed in a single day of clashes and attacks claimed by Sinai Province on 1 July.

A witness in Gaza saw a plume of dark grey smoke rising from a boat off the coast. Other witnesses in the territory said they had heard explosions and gunfire.

An Israeli military spokeswoman said Israel was not involved in the incident and had not been asked to assist.

Military sources said the suspected militants had fled after firing on the vessel.