The suspects breathed a sigh of relief when the judgment was delivered to them by Chief Magistrate Rosemelle Mutoka as that was seen as the "most lenient" punishment meted out against pirates since Kenya agreed to handle and prosecute piracy cases.
In 2006, the first group was sentenced to seven years while early this year, another batch of seven were jailed for 20 years.
On Monday, their lawyer Jared Magolo took time to explain to the court why his clients should be released, and argued that their continual stay will be more of a burden to the taxpayer since they have to be fed and clothed.
The suspects had been charged with attacking a German Ship, MV Spessart in March this year upon the high seas and further causing fear among the crew of the ship.
The court had been told that they were armed with AK47 Rifles, Rocket Propelled Grenades (RPG), skiffs and other weapons which they used to terrorize the crew with.
They were handed over to the Kenyan authorities for prosecution after being arrested at the high seas.
The magistrate said, "this court is sending a very loud message to Somalia youths that piracy does not pay and they should not engage in it."
The suspects however in mitigation told the court they had changed after staying at the Shimo La Tewa prison for many months adding that they had wives and children back in Somalia.
One of the suspects, Mohammed Ahmed, said through an interpretor, "We have been rehabilitated and it now time for us to launch a massive campaign against piracy, we are remorseful about what we did, what we have gone through is punishment enough."
Magolo compared the prison with others in other countries terming their stay in Kenya as torturous and asking the court to be lenient when making the ruling.
State counsel Alexander Muteti had earlier told the court piracy had a negative impact in the region, and asked for them to be punished severely so as to be a lesson to others in future.
The suspects were asked to appeal against the judgment in 14 days.