Madrid, Spain (CNN) -- In a rare case, a Spanish court convicted two Somalia men of piracy in the 2009 takeover of a Spanish fishing vessel and sentenced each to 439 years in prison, according to a copy of the sentence viewed by CNN on Tuesday.
The long prison terms stem mainly from the conviction for illegal detention of the vessel's 36 crew members, with a sentence of 11 years for each count of piracy, or 396 years.
In addition, the defendants were convicted on three other counts, including armed robbery and belonging to a criminal gang, which boosted the overall sentence to 439 years.
The vessel, the Alakrana, was freed in November 2009 after being held for 47 days off the coast of Somalia. The crew included 16 Spanish sailors and 20 from Africa and Asia.
A day after the hijacking by 12 armed pirates, Spanish military monitoring the situation captured two pirate suspects on Oct. 3, 2009 as they left the fishing vessel. Then authorities took the unusual step of bringing them to Madrid.
Many other pirate suspects who have been captured by international military forces --- trying to ensure the safety of merchant shipping and fishing off the coast of Somalia --- have been taken to African nations for court procedures, but not to Europe.
The Spanish court identified the two as Raageggesey Hassan Aji, of Ceel Maccan, Somalia, who was born in 1978, although his birthdate was not disclosed; and Cabdiweli Cabdullahi, of Marka, Somalia, with no age given, although the court determined before the trial that was an adult.
Defense lawyers argued unsuccessfully for their acquittal.
Despite the 439-year sentences, a court official told CNN that the likely maximum that could be served for such convictions is about 30 years.
Spanish media reported in 2009 that a ransom had been paid to free the ship, and a leading Spanish fishing industry executive, Juan Manuel Vietes, told CNN at the time he was certain a ransom was paid for the release of the tuna trawler, but he didn't know the amount.
The Spanish government did not say how the ship had been freed.