A gunman who took three people hostage at a German city hall, forcing chancellor Angela Merkel to cancel a planned election rally there has been captured and his captives rescued unharmed..

The hostages included a deputy mayor of the Bavarian city of Ingolstad, who was released first.

German news agency reports said the gunman had previously stalked a female employee at the city hall.

The incident began several hours before Mrs Merkel was due in the city for a rally that was to take place on the square in front of the city hall. Germany holds national elections on September 22, and Bavaria votes in a state election a week earlier.

There was no indication of any connection between the visit and the hostage-taking. However, Mrs Merkel's conservative Christian Democratic Union said it decided to cancel the rally.

The old city hall, one of two city halls in Ingolstadt, dates back to the 14th century, though the building was expanded in the 19th century. It is home to the mayor's office and the city's tourist information office, among other administrative departments.

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.