Denmark says a ransom was paid to free a Danish cargo ship and its crew who were held by Somali pirates for nearly three months.

A Danish Foreign Ministry official, Lars Thuesen, has confirmed that ship owner Joergen Folmer paid the ransom, although he would not say how much.

The pirates had demanded $1.5 million for the ship and its five-man crew.

The freighter, the Danica White, and its crew were turned over Wednesday to a French warship.

The Foreign Ministry official says the crew members are all in good health. They had been held hostage since their ship was seized off the coast of Somalia June 1, while traveling from Dubai to the Kenyan port of Mombasa.

Soon after the hijacking, a U.S. ship fired warning shots at the Danica, but abandoned pursuit after the pirates took the ship into Somali waters.

Pirate attacks are common in the waters off Somalia. The country has operated without a central government since 1991, when warlords overthrew the dictator Mohamed Siad Barre.