The five accused all German citizens with Somali origin received prison terms of between three and half and five years, by the Frankfurt higher regional court.
The five identified as brothers Abdullah, Abdulsalam and Abdiwahid W., the brother-in-law of one of them, Steven N., and a German-Tunisian friend, Mounir T. are believed to have travelled to Kenya in 2012 and on 2013 crossing over to Somalia. Some had taken their wives and children.
The court in a statement said the men underwent combat training of 13 and 18 months at various Al-Shabaab bases.
In July 2014, they opted to leave not contented with rigid treatment of foreign fighters by Al-Shabaab leadership.
Three of them contacted Germany embassy in Nairobi where they were arrested and deported back to Frankfurt.
Two others identified as Abdiwahid W. and Mounir T. had plans to get to Syria to join ISIS but were arrested in Kenya and deported to Germany.
A small fraction of Al-Shabaab which comprises of foreign fighters are usually treated with suspicion on being western spies. Most of them are tortured and even ends up being killed.