Five officers were injured in the riot that began at around 3:00 am (0100 GMT) when police intervened to stop a brawl involving around 30 people in Frankfurt's historic Opera square.
The square has become a popular gathering place for what local media have dubbed “corona parties” as Germany's bars and clubs remain closed to contain the spread of the virus.
Some 3,000 mainly young people filled the square again on Saturday evening but only around 500 to 800 were still there when the unrest started, Frankfurt police chief Gerhard Bereswill told a press conference.
A small group of officers moved in to help a bleeding man and end the brawl, but the crowd turned on them.
“What I find especially abhorrent is that bystanders cheered and clapped when bottles hit my colleagues,” Bereswill said.
Back-up police then arrived and cleared the square, while facing “a hail of bottles” from the angry crowd, he said.
A total of 39 arrests were made, including one woman.
The others were men aged 17-21 “most of whom have a migrant background”, Bereswill added.
Eight people remain in custody and face possible charges of disturbing the peace.
The incident recalls the unrest that erupted in Stuttgart last month, when police carried out drug checks in the city centre where hundreds of people had gathered.
The crowd attacked officers with stones and bottles, smashed shop windows and plundered stores in an hours-long rampage that stunned Germany.
German police unions and emergency workers have been warning of authorities facing greater hostility as they go about their work.
Tensions have also spilled over from the Black Lives Matter demonstrations in the United States where officers are accused of being racist.
Bereswill said that although the majority of revellers were peaceful, Frankfurt police have noticed “increasing aggression” towards officers in the early morning hours of the open-air parties.
Sunday's escalation “was absolutely the most negative climax of this development”, he told reporters.
Several police vehicles and a bus stop were also attacked in the violence, causing thousands of euros in damage.
Frankfurt Mayor Peter Feldmann on Twitter condemned the rioters' “unacceptable” behaviour and called for more police presence at party “hotspots”.
City authorities will meet on Monday to discuss possible measures in response to the unrest.