Police have ended a hostage standoff at a city hall in southern Germany by storming a building, shooting and wounding the captor, with all hostages released unharmed.

Police shot the 24-year-old kidnapper in the legs and shoulder on Monday night when they stormed the Ingolstadt city hall building in Bavaria, said a police spokesman.

The kidnapper had taken three people hostage including a woman he had previously harassed, and the city's deputy mayor. Two were released earlier in the day with the woman released after the kidnapper's arrest.

Police said in a statement that they were forced to use their weapons because the kidnapper "was carrying a plastic gun which looked like a real weapon, and a big knife''.

Bavaria's interior minister, Joachim Herrmann, told the German news agency DPA that the female employee had been harassed for more than a year by the kidnapper.

"The captor had an order to stay away from city hall and thought he could force his way back in to be closer to the woman he stalked,'' Beck said. "It was a classic case of stalking."

Source: Agencies