By Spy Uganda
The soldiers were serving with the African Union (AU) peacekeeping forces mission in Somalia (AMISOM).
Three other soldiers were each given 39 years in prison, according to media reports.
A spokesman for the region’s farmers, Hussein Osman Wasuge, told reporters that relatives of the victims and farmers attended the proceedings in the Somali capital.
The case has been dragging since October at the UN and AU headquarters in Mogadishu.
“For us as Somalis, there were no lawyers to represent us but we are happy about the outcome and this should be a lesson for all foreign troops in our country, referring to AMISOM,” one relative said.
AMISOM previously admitted that its soldiers killed farmers during an operation against al-Shabaab terrorists on the outskirts of Golwayn.
Tensions have been high recently between Somalia and the AU as the two sides discuss the future of AMISOM.
Somalia asked the African Union Commission (AUC) representative to leave the country in one week after declaring him persona non grata earlier this month.
Simon Mulongo is no longer welcomed in Somalia because of his alleged activities that are not under the country’s laws, the Foreign Ministry said in a statement.