A special police unit has arrested a hostage-taker and freed his captives at the city hall in the Bavarian city of Ingolstadt.
The standoff began at 9am (8am Irish time) and prompted Chancellor Angela Merkel to cancel an election rally there.
Police spokesman Guenther Beck said the 24-year-old man was injured during the police raid on the building. The two remaining captives were freed unharmed.
Mr Beck said it was not clear how the hostage-taker was injured.
Earlier in the day, the captor freed two other people he had kidnapped at the building.
More than 200 police officers surrounded city hall for nearly nine hours before the special unit raided the building.
Bavaria's interior minister Joachim Herrmann said the man was a known stalker and had been banned from entering Ingolstadt city hall because he had harassed a female employee there.