Ukraine said a cargo ship laden with weapons, which was held by pirates off the coast of Somalia since September, has been freed.

In a brief statement, the office of Ukraine President Viktor Yushchenko said a Ukrainian arms ship and its crew of 20 seamen - a Latvian, two Russians and 17 Ukrainians - were freed by Somali pirates.

The vessel's captain died, apparently of natural causes, two days after the ship was seized in the Indian Ocean.

Mr. Yushenko's statement welcomed the end of the protracted process to free the MV Faina. He said it came after "an operation involving special services agents" from Ukraine.

The ship owner's spokesman, Mikhail Voitenko, said a ransom was paid to about 100 pirates on board the MV Faina. Russian media reported that about $3.2 million was dropped on the ship from an aircraft.

But the captain of a Danish vessel, which was also seized near Somalia before being freed, warned of euphoria.

Speaking through an interpreter to media, Captain Andrey Nozhkin recalled what happened when ransom was paid for his crew last month.

"As soon as the money was received it became tense. Their leader sat down on top of the money, reloaded his machine gun, then threw two ammo clips, and up to 16 hours they were dividing the money among themselves. And all that while, they were doing drugs at the same time," he said.

The Ukrainian presidency statement said the vessel had resumed its journey to its initial destination, the Kenyan port of Mombasa.

During the ordeal, the Ukrainian arms vessel was closely monitored by U.S. ships because it was stocked with weapons, including dozens of refurbished T-72 tanks and thousands of tons of other military equipment.

Kenya claims the weaponry is for its armed forces, but several sources said the cargo was intended for the government of South Sudan.

There has been international concern the weapons could end up in the hands of terror groups such as al-Qaida.

Ukraine's government has come under pressure to explain the shipment.

About a dozen other vessels are believed to remain in captivity off Somalia's coast.