Kenyan court in the coastal city of Mombasa sentenced nine Somalis to five years in prison each for attempting to hijack the German merchant vessel MV Courier in the Gulf of Aden in March 2009.
The men were arrested by international anti-piracy forces before being handed over to Kenya to be prosecuted, as Somalia was not considered able to try them properly.
Although the number of attacks has fallen markedly since 2011 thanks to tougher security aboard ships and increased Western naval patrols, piracy emanating from the Horn of Africa nation may still cost the world economy about $18bn a year, the World Bank said in April.
Prosecutors told the court on Tuesday the men attacked the ship armed with a rocket launcher, an AK-47 rifle, a pistol, a SAR80 carbine rifle, and other weapons.
"The suspects used violence to hijack the vessel, and took control of it, putting in fear the lives of those aboard," prosecutors said in the charge sheet.
Kenyan officials said 18 crew on board survived the ordeal.The nine suspects were held in custody at one of Kenya's maximum security prisons during the trial period. They all denied the accusations.
While handing out the sentence, the court noted that the accused had already served a long term in jail while the trial was in progress, and therefore were given shorter jail terms.
"I am satisfied with the evidence presented by the prosecution, which proves beyond reasonable doubt that an act of piracy was committed," judge Stephen Riech said. Riech ordered the nine to be deported to Somalia after serving their sentences.
Last month another nine Somalis were handed a similar sentence at the same court, after also being found guilty of hijacking a ship in the Gulf of Aden in 2010.