A man and woman being held hostage at Ingolstadt town hall in the German state of Bavaria have been released unharmed. A second man was freed earlier in the day.
The 24-year-old assailant, who has a history of psychiatric problems, is believed to have been injured and is now in police detention.
The security forces and the Bavarian Interior Minister, Joachim Hermann, had been in contact with the armed man since the drama began around 9.00 am on Monday.
German Chancellor Angela Merkel had been due in the city as part of her re-election campaign, but cancelled her trip.