A court in Bavaria has convicted an Iranian and three Afghan men over their drunken assault of passers-by that prompted a public outcry in Germany in December.

The Amberg regional court on Friday sentenced the 18-year-old Iranian, whose name wasn't released, to two years and seven months of juvenile detention.

The three Afghan men were given suspended sentences of between six and 13 months.

The defendants, who have all applied for asylum in Germany, can appeal the verdicts.

Fifteen people were hurt when the men, who were intoxicated at the time, assaulted passers-by near the town's train station.

Bavarian governor Markus Soeder condemned the attacks and "the fact that certain far-right groups are trying to abuse this."