Nils Donath, a 25-year-old German national, had travelled to Syria in October 2013 to join the jihadist group which controls a large swathe of Syria and Iraq.
Prosecutors, who had sought a sentence of four years and nine months, said at the trial that tasks Donath took on at the IS included assisting in interrogations, prison guard duty, as well as participation in the jihadist group's "storm troops," a special assault team.
As a member of this unit, Donath took part in 10-15 missions, in which he helped to track down IS deserters, fully aware they would be tortured to death, according to the prosecution.
Donath has been in police custody since his arrest upon his return to Germany in January 2015.
During the trial that opened in January, he told the court of his troubled teenage years, when he was a "pothead" before he converted to Islam in August 2011.
But he later "slipped into radicalism" and joined a local jihadist group called the "Lohberger Brigade" that he travelled with to Syria.
Thousands of Europeans have headed for Syria to fight for the IS group, and concern is growing about the threat that returning jihadists pose on their home soil.