Police said only a large-scale show of force restored order after the teens threw bottles at the windows of the police station in the Bavarian town of Starnberg, near Munich, and tried in vain to break open the entrance door late Thursday.
A window was broken and officers from neighbouring towns were called in to help restore order.
“Only through a massive deployment… could the situation on site be brought under control,” said a statement from Bavarian police.
Three teens were arrested and charged with attempting to free a prisoner and damage to property.
Disturbance at school-leavers party
Events had escalated after police were called to a disturbance at a school-leavers party in the affluent rural town on Thursday night.
A 15-year-old, who appeared drunk, “provoked and insulted” officers in “an aggressive manner” and refused to leave.
After the youth was taken into custody, a group of teenagers left the party and tried to storm the police station, which led to the riot.
Police are considering charges of breach of the peace and stepped up patrols during Thursday night.
In an open letter, those involved apologised. “Our school community wanted to celebrate a friendly get-together to sign off the academic year,” read the statement.
“We are very sorry this escalated.”
Bavaria's regional interior minister slammed the rioters.
“The incidents in Starnberg are absolutely out of the question,” conservative politician Joachim Herrmann told German daily Bild.
“Revelry and alcohol are no excuses for such riots.”
“These are not trivial offences. The behaviour of these young people must be strictly punished.”