A SPANISH court has sentenced two Somalis to 439 years in jail each for the 2009 hijacking of a Spanish fishing boat in the Indian Ocean and said government-linked bodies paid a ransom to secure the boat and crew's release.

The National Court also said that those convicted were Cabdiweli Cabdullahi and Raageggesey Hassan Aji.

The Alakrana tuna boat with 36 crew was seized off Somalia in October 2009 and held for 47 days.

A reported $US3.3 million ($A3.02 million) ransom was paid. Spain says it does not pay ransoms but in the Alakrana case, the government said earlier it did what it had to do.

Spanish commandos captured the men as they sailed away from the boat during the hijacking.