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 extremist group's "storm troops," a special assault team.
Islamic State confirms death of 'Jihadi John' in Syria drone strike
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.
Millions of British households to get pro-EU leaflets
According to a Spiegel Online report, he left Syria after changing his mind about the IS, and managed to escape after telling the extremists that he was heading back to Germany to bring his daughter to Syria.
Taking the stand at a court in Duesseldorf, 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 extremist group called "Lohberger Brigade" and travelled with it to Syria.
Surprise assault: Da’ish fighters kidnap 400 civilians in 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 extremists pose on their home soil.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ