A 17-year old gunman has gone on a shooting spree at his former school in southwest Germany, killing up to 15 people before dying himself in a shootout with police, authorities said.
The former student, identified by police as Tim Kretschmer, dressed in black combat gear, entered the Albertville-Realschule in Winnenden, a town of 27,000 near Stuttgart, at around 9.30am (9:30pm NZT) and began firing with a 9-millimetre Beretta pistol at students in a classroom.
He killed nine students, including eight teenage girls, and three women teachers, as well as one person in front of a clinic opposite the school, before fleeing with a hostage in a car hijacked at a local supermarket.
Police said most of the victims at the Albertville- Realschule had been shot in the head and a further seven pupils, all female, were injured.
The gunman died hours later in a shoot-out in Wendlingen, some 30 km from the school, after killing two men in a car dealership. Those killings brought the death toll to 16, including the gunman, who police believe shot himself.
"Nobody can understand it," said Roberto Seifert, who works near the school. "Everyone is in shock."
Chancellor Angela Merkel called it a day of mourning for all of Germany. "It is unimaginable that in just seconds, pupils and teachers were killed - it is an appalling crime," she told reporters in Berlin.
The local church held a candlelight service to remember the victims. About half the 1000 people there had to stand and many wept and hugged each other during the service.
Germany has strict laws which require gun-holders to fulfil criteria on age and weapons expertise to obtain a firearms licence.
Police said the gunman had apparently used a gun registered to his father, who belongs to a shooting club and had a collection of 15 guns at home.
The killer took the one gun that was not locked up, but kept in his father's bedroom. Large amounts of ammunition were also missing from the family home.
School officials described Kretschmer as an unremarkable student with average grades. A picture of him posted on the website of German newspaper Bild showed a young man with short hair, sideburns and glasses.
"There are no indications at the moment of any warning or suggestion that the attack could have been foreseen," Heribert Rech, interior minister of the state of Baden-Wuerttemberg, told a news conference. "It is conspicuous that most of his victims were females," he added.
A 19-year-old neighbour of Kretschmer who identified himself as Michael and said he used to play table tennis with the gunman, described him as a loner who had a big collection of horror films.
"This really shocks me," he said, standing across from the Kretschmer family home. "I had never thought this could happen."
Police estimated the age of those who had died at 14 to 16. Eight died immediately and another died later from injuries. One of the dead students was believed to be from Kosovo.
The school was evacuated and rescue workers, fire fighters and heavily-armed black-clad SWAT teams rushed to the scene.
Forensics experts clad in white suits were at Kretschmer's home, where his personal computer was being examined.
The shooting is the latest in recent years to shock Germany. In 2006, a masked man armed with rifles and explosives attacked a school in the western town of Emsdetten, wounding 11 people before killing himself.
In April 2002, Germany suffered its worst school shooting when a gunman killed 17 people, including himself, at a high school in the eastern city of Erfurt.
The killing spree on Wednesday followed a rampage in the United States on Tuesday in which a gunman shot dead 10 people then killed himself in southern Alabama.