A French defence ministry photo shows the pirates surrendering
A group of Somali pirates has been captured after attacking a French navy ship by mistake, apparently thinking it was a harmless cargo vessel.
French military spokesman Admiral Christophe Prazuck said the pirates attacked in skiffs late at night some 500km (310 miles) off the Somali coast.
But the command and supply ship, the Somme, repelled the attack and chased the pirates, capturing five of them.
Dozens of international warships fight piracy in Somalia's lawless waters.
The country has had no effective central government since 1991, leading to a complete breakdown of law and order, and pirates operate off the coast almost with impunity.
Admiral Prazuck told French TV station La Chaine Info the pirates seemed to be surprised that the navy ship fought back.
"Once they realised they were facing a ship that was responding and was heading towards them, they stopped shooting and attempted to flee," he said.
French military spokesman on the foiled attack
"The Somme gave chase and intercepted one of the pirates' boats. All the weapons had apparently been tossed into the sea and the suspected pirates are now being held on board the Somme."
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.
Although the international naval forces have stepped up patrols in the Gulf of Aden this year, relatively few of the pirates detained have faced trial because of the legal complexities involved.