Nils D., a 25-year-old German national, had travelled to Syria in October 2013, where he "took on several tasks within the Islamic State organisation," prosecutor Carola Bitter said.
They include 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, D. allegedly took part in between 10 and 15 missions, in which, masked and armed with a Kalashnikov, he helped to track down IS deserters -- fully knowing that those caught could be tortured to death, Bitter told the court.
Although he did not fight on the front lines, he looked on as executions were carried out by the IS group, and was trained to handle weapons and make explosives, she added.
The accused has been in police custody since his arrest upon his return to Germany in January 2015.
According to a Spiegel Online report, he left Syria after changing his mind about the IS, and managed to escape after telling the jihadists that he was heading back to Germany to bring his daughter to Syria.
Taking the stand at a court in Düsseldorf, western Germany, D. recounted his troubled teenage days, when he admitted he was a "pothead" before converting to Islam in August 2011.
"I practically slipped directly into radicalism," he said, adding that he subsequently joined a local jihadist group called "Lohberger Brigade" and travelled with it to Syria.
D. risks a 10-year sentence, but his willingness to provide details of the IS organisation to investigators may be a mitigating factor.
Thousands of Europeans have travelled to Syria to fight for the IS group and concern is growing about the threat that these returning jihadists pose on their home soil.