The Tokyo District Court sentenced Mohamed Urgus Adeysey, 23, and Abdinur Hussain Ali, 38, to 10-year prison terms Friday.
Both defendants admitted taking part in the attempted hijacking, The Japan Times reported Friday.
In the first case tried in Japan under a 2009 anti-piracy law, the primary issue was whether the judge would impose a prison term or offer a suspended sentence so the convicted men could be deported to Somalia, the newspaper noted.
The court said that, although Adeysey, Ali and two other Somali citizens in custody in Tokyo failed to hijack the 57,000-ton ship, their actions were nonetheless vicious and well-planned.
Sign language interpreter at Mandela service called out as fake on Twitter
Puzzle-maker slips 'Murdoch Is Evil' into Rupert Murdoch's Sunday Telegraph