The suspected Islamic State terrorist Nils D standing trial in the western German city of Dusseldorf on Friday described details of the group's torture practices.
The 25-year-old has already acted as a valuable witness in two terrorist cases, before appearing in this case on Wednesday.
The suspect, who has confirmed his service in s special unit of Islamic State, gave descriptions of public beheadings on the market square, as well as the extremist group's torture practices and cruel prison conditions.
The man recalled seeing 20 Islamic State prisoners beaten with a stick by the prison warden, while suspended from the ceiling for hours with their hands tied behind their backs.
Prisons were crowded and the screams of the torture victims could be heard in the neighbouring building where he spent most of his time.
Prisoners were locked in narrow cages with only small openings for air. "They were like cupboards," Nils D said.
Once or twice a month people were also executed on the market square, according to the defendant. He had witnessed around 10 executions himself. Individual victims had been beheaded by a disguised Tunisian henchman with a sword.
"They were never cleanly beheaded. Their heads were still dangling when they nailed them to the cross to be displayed by the main road for several days," he said.
The market place had always been crowded, with onlookers - himself included - shouting "Allahu akbar."
The defendant testified that he arrested people while dressed in disguise and carried them to the prison. Women and children screamed and cried when he captured male "suspects," some of which had only been charged with un-Islamic behaviour.
He recalled women commonly fainting and said he found their reaction exaggerated and laughed.
He added, however, that he felt sorry for the children calling for their fathers.
Nils D had sworn allegiance to the Islamic State even though he had already decided to leave Syria. He would have risked being beheaded himself, had he refused, the defendant told the court. "If you don't pledge allegiance to the caliph, you are the enemy."
The federal prosecution charged the suspect from Dinslaken in the Lower Rhine region with being a member of an Islamic State special unit.
He stands accused of using weapons and violence to detain spies and deserters of the terrorist group, bringing them to Islamic State prisons.
The defendant has several previous convictions and has spent six months in prison for breaking and entering as well as theft. He had also been sentenced to six months on probation for drug dealing as a youth.
If found guilty, he faces up to ten years in prison for membership of a terrorist organization.