The Danish government says the owners of a Danish cargo ship seized by Somali pirates in June paid a ransom to secure its return.
Pirates target passenger and cargo vessels for ransom or loot
A spokesman said the government was disappointed, but understood why the Danica White's owners had paid for the release of the ship and its five crew.
No details of the deal were given, but Danish television reported that the pirates had demanded $1.5m (£750,000).
The pirates turned the vessel over to a French warship on Wednesday.
It was expected to arrive in Djibouti this weekend, and Denmark planned to send a plane to bring the crew home, the government spokesman said.
The Danish ship was hijacked off the Somali coast on 2 June while heading for the Kenyan port of Mombasa to deliver a cargo of building materials.
The five crew members are undergoing a medical evaluation before being reunited with their families.
The Danish foreign ministry said the crew are in good condition, "although the hijacking has been a great strain".
Days after the ship was captured, a US ship fired several warning shots across its bow and destroyed three boats the pirates had used in their attack and were towing behind the Danish vessel.
But the US ship stopped its pursuit after the pirates navigated the Danica White into Somalia's territorial waters, where the US does not have jurisdiction.
Somalia's waters are reported to be among the most dangerous in the world.
Somali pirates are trained fighters, and often use speedboats equipped with satellite phones and Global Positioning System technology.
They target passenger and cargo vessels for ransom or loot, and use the money to buy weapons.