A 21-year-old refugee in Germany has received a two-year, nine-month prison sentence after setting fire to a homeless man sleeping on a Berlin underground station bench last Christmas Eve.

Only the intervention of other passengers ensured the fire was extinguished and the sleeping man, a 37-year-old from Poland, came to no harm. Five other men, one just 16, were given suspended sentences as accessories to the attack. With its sentencing, the court declined to follow the state prosecutor demand for a four-year attempted murder conviction.

The attack by the seven refugees, aged between 16 and 21, incensed Germans and hardened public attitudes to the one million asylum seekers accepted in 2015 and 2016.

“I cannot conceive now what I did, we wanted to play a trick,” said the 21-year-old ring-leader, named in court only as Nour. Apologising for his actions, he said in a statement: “I am aware how disastrous an image this gives of refugees.”

The man said he grew up in a camp for Palestinian refugees in Damascus until he fled to Germany. On Christmas Eve he drifted through the German capital with a group of other asylum seekers he claimed not to know, consumed ecstasy, heroin and half a bottle of vodka-cola.

Security footage from one U-Bahn train station shows what happened next: the men gathered around a green wooden bench in Schönleinstrasse train station where an animated Nour lit a tissue and laid it near the head of the sleeping man.

As the man’s rucksack caught fire the men pulled up their hoodies and disappeared, laughing, into a train.

“They left the spreading of the smouldering fire to chance,” said the prosecutor, and their victim at risk of burning “tortuously”.

“That the victim didn’t die,” the prosecutor added, “is no thanks to the accused.”

Train station cameras show other passengers rushing to extinguish the fire, leaving the homeless man sitting dazed beside his singed possessions.

The other defendants had similar biographies to Nour with three receiving eight-month suspended youth sentences for failure to assist a person in danger. Two others, a 16-year-old named only as Bashar and a 19-year-old called Mohamad were given additional two-year juvenile sentences on probation.

During the trial, psychological experts criticised a series of failures by Berlin welfare authorities and said the case spoke volumes about the fate of underage refugees who disappeared through the cracks of the system to join gangs.

Among those handed suspended sentences was Bashar, just 14 when his father, a teacher, was arrested in Damascus and disappeared two years ago. His mother paid traffickers to get her son to Germany, where he fell between the cracks. A third accused, 17-year-old Ayman, worked as a car mechanic in Libya until his brother was kidnapped and he fled.

“I didn’t come to Germany to sit in prison,” said Mohamad, by way of apology, “Not even a crazy person does that.”