Islamic State's Egypt affiliate, Sinai Province, said on Thursday it had carried out a rocket attack on an Egyptian naval vessel in the Mediterranean Sea.

The claim of responsibility by the Sinai Province of the Islamic State, as the group calls itself, was made in a brief statement posted on Twitter accounts known to be linked to the group.

The authenticity of the statement could not be immediately verified, but it was accompanied by photos purporting to show what appears to be a rocket flying toward the vessel, a large explosion engulfing most of the boat and then black smoke rising up from the vessel.

The Egyptian military said earlier a coastguard vessel had exchanged shots with militants off the coast of northern Sinai, an area bordering Israel and the Gaza Strip. The boat caught fire but the incident resulted in no casualties, the military said.

L'#EI au Sina revendique la destruction d'un navire de la marine égyptienne (visiblement amarré près de la cte) pic.twitter.com/29d9NuZPJ7

A witness, fisherman Abu Ibrahim Mohammed from the neighboring Gaza Strip, said the vessel was a gunboat that was about a nautical mile off the coast when it caught fire. He did not hear the explosion but saw two smaller boats later trying to put out the fire and that a third, larger one later arrived and towed the burned vessel away. Two speed boats were seen later combing the area as gunshots occasionally rang out, he added.

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

The vessel, according to the security officials, routinely patrols Egyptian territorial waters and has frequently been used to transport army and police personnel to mainland Egypt, the officials said. The sea route avoids the overland journey through Sinai, where Islamic militants target government forces.

On Wednesday, the military said it foiled an attempted attack on a military post on a highway linking Cairo with the Red Sea coast. The driver of a car that was carrying 500 kilograms (1,100 pounds) of dynamite refused to stop at a checkpoint, drawing fire from the troops, the military said. The car then swerved off the road and the driver was killed, the military said in a statement.

Egypt's Islamic State affiliate said it was behind Wednesday's incident, claiming the car's driver was a suicide bomber who had detonated his explosives' load, killing several soldiers. The authenticity of the claim could not be independently verified, though it was carried by Twitter accounts affiliated with the group.

The military denied the claim.

Egypt faces threats from multiple insurgent factions, including the ISIS affiliate in Sinai, which the military says killed at least 17 soldiers in a July 1 assault there. Officials from several branches of Egypt's security forces previously told The Associated Press that that attack killed dozens more.

Last week, ISIS claimed responsibility for a bomb attack in front of the Italian consulate in central Cairo, in which one person was killed. In another attack claimed by the ISIS group, Egypt's state prosecutor, Hisham Barakat, was assassinated in Cairo by a car bomb in late June.