Fresh from knocking out the long-time mayor of Freiburg in south-west Germany in a surprise election victory, Martin Horn was celebrating his success when a man hit him in the face.
Mr Horn, a 33-year-old independent candidate, had his nose broken and a tooth knocked out in the attack, and had to be treated in hospital.
A man aged 54 was arrested and the attack is not being seen as political.
Defeated Green candidate Dieter Salomon was mayor of Freiburg for 16 years.
A university town, Freiburg has one of Germany’s youngest populations and Mr Horn campaigned on a platform of affordable housing to keep pace with growth.
He had just given a round of interviews after his election win and was celebrating with 300 supporters when he was approached by a man apparently seeking a selfie.
“Suddenly there was disturbance. The guy struck Martin Horn in the face,” local centre-left politician Julien Bender told German media.
More stories from Germany:
According to police investigating the unprovoked attack, the suspect has a background of psychiatric illness.
The victorious candidate went on Facebook to tell his supporters not to let the incident get them down.
“I have a broken nose, two small stitches and a broken tooth,” he said before returning to the party to enjoy his victory.
Expressing shock at he attack, the outgoing mayor wished his political rival a speedy recovery.
This is not the first time an elected German mayor has been attacked in recent years.
Cologne mayoral candidate Henriette Reker was stabbed in the neck and seriously wounded in 2015 by a man angered by her policies in favour of welcoming refugees. She went on to win the vote the next day.
Last year, another pro-refugee mayor, Andreas Hollstein, was also stabbed in the neck in the western town of Altena and needed hospital treatment.
German mayor wins Freiburg vote but loses tooth in attack