Five Somali pirates have been arrested after mistakenly attacking a French navy ship, believing it was a cargo vessel.

According to French military spokesman Admiral Christophe Prazuck, the pirates attacked in skiffs late at night some 500km off the Somali coast, Reuters reports.

The command and supply ship, the Somme, which was involved in a European anti-piracy operation for a commercial vessel, repelled the attack and captured the pirates.

About two dozen ships from European Union nations, including Britain, France, Germany and Italy, patrol the waters off Somalia – an area of about two million square miles.