Groups of people have smashed shop windows, looted, and attacked police vehicles in central Stuttgart during hours of night-time disturbances.
German police say more than a dozen police officers were hurt during the violence, in south-west Germany.
Video clips on Twitter show people vandalising shops in the city centre and hurling big stones and other objects at police vehicles.
Stuttgart police say the violence began after police checked a drugs incident.
The situation escalated after a 17-year-old was questioned for an alleged drug offence, the city’s police vice-president Thomas Berger told reporters.
A group of between 100 and 200 people responded by throwing stones and bottles at the police on the central Schlossplatz, a large square.
This then grew, he said, to between 400 and 500 people attacking police. Many of the rioters were said to be hooded and masked.
Police president Frank Lutz suggested the situation had become more tense over the past three to four weeks.
What he described as people from the “party and event scene” in Stuttgart had been getting drunk in public and adopted an aggressive and insulting tone towards police on social media.
Local politicians and ordinary citizens expressed shock, saying the scale of the rampage was unprecedented for Stuttgart in recent years.
A mobile phone shop and a jewellery store were among the businesses attacked and looted. Some fast food outlets were also vandalised, public broadcaster SWR reports.
In total, 40 shops were damaged, and nine looted.
Some rioters threw chunks of paving stone and other missiles at passing police cars. At one point, the police said, the situation was “out of control”.
More than 200 extra police were rushed into the city centre, where shops had been attacked apparently at random.
The situation was calmer after dawn and firefighters and civil protection volunteers (THW) began repairing the many damaged shop fronts.
Twenty-four people were arrested – 12 Germans and 12 described as non-German. Police have appealed for witness evidence including mobile phone footage.
Nineteen police officers were injured and 12 poli