German police say around 50 teenagers tried to free one of their friends from a police precinct in Bavaria after he was detained at a high school graduation party following a drunken rampage.

Police in the town of Starnberg said the 15-year-old teenager was detained after a security guard at Thursday night's party called authorities when the boy asked for drugs and turned aggressive.

Deutsche Welle reported officers found the teen at the graduation party was “visibly under significant influence of alcohol” and “remained aggressive” in front of the officers.

The teen, whose name has been withheld in line with German privacy rules, reportedly refused to heed officers' orders to leave the venue, which led to his being arrested.

The teen was taken to the police precinct, but a group of about 50 to 100 students, presumed to have come from the same party, followed and tried to break him free.

The Complete Guide To: Bavaria Show all 6 1 /6 The Complete Guide To: Bavaria The Complete Guide To: Bavaria On the hoof: a garlanded cow with its owner in traditional dress Getty Images The Complete Guide To: Bavaria Fun on tap: Drink up the atmosphere at one of Bavaria's famed beer festivals AP The Complete Guide To: Bavaria Rococo gem: Neuschwanstein, Ludwig II's version of Versailles AFP/Getty Images The Complete Guide To: Bavaria Late-baroque architecture in Munich Getty Images The Complete Guide To: Bavaria Fog lifts from countryside near the city AFP/Getty Images The Complete Guide To: Bavaria Snow business: Bavaria has far more ski facilities than anywhere else in Germany AP

A window was broken, and students also attempted to remove the police shield from the door - though none of the students made it through the door.

German news agency dpa said police from nearby stations were called in to calm the youths, two of whom were temporarily detained.

The boy then complained about headaches and was taken to hospital.