VIDEO: Teenage gunman's rampageVIDEO: Phone footage of German gunman
A teenager in black combat gear went on a rampage at his old school in Germany on Wednesday, killing at least 15 people before turning his gun on himself in a shootout with police.
The 17-year-old, named as Tim Kretschmer, entered the secondary school in Winnenden near Stuttgart at 9.30am (1930 AEDT), killing nine pupils aged 15 to 16 and three teachers with a handgun taken from his parents' mini-arsenal.
In a dramatic manhunt with swarms of armed commandos on his trail assisted by helicopters and dogs, the teenager described as "reserved" randomly killed three others before being cornered by police 30km away.
There was no immediate indication of motive, but the gunman's victims were primarily female: eight of nine students killed were girls, and all three teachers were women. Three men were killed later as the suspect fled.
"I heard two shots and then screaming," said a 15-year-old student who gave her name only as Betty. "At first I thought it was a joke, but then someone called 'Run, run!' and I saw students jumping out of the windows and took off running."
The gunman took students in the first classroom completely by surprise, evidenced by the morbid scene that awaited the first officers to arrive, said regional police director Ralf Michelfelder.
"Children were sitting at their tables, with pencils still in their hands, their heads fallen over on the table," he said. "Most of them had shots in their head - it must have all happened in seconds."
He wandered into several classrooms at the school he left last year with "average" marks.
"He didn't just shoot indiscriminately," said Heribert Rech, interior minister of the state of Baden-Wuerttemberg where the nightmare unfolded.
Kretschmer went into classroom 10d three times, the Bild daily said on its website, hissing on the third visit: "Aren't you all dead yet?"
A teacher threw herself in front of a female pupil - and was shot by the gunman, Bild said.
"He just opened the door, pulled out his gun and started shooting," one pupil said on German television. "One person saw someone shot in the head."
"My brother was in the classroom in which it happened," said another. "He was sitting next to his girlfriend and she was shot."
The German school shooting came just hours after a gunman went on the rampage in the southern US state of Alabama, killing 10 people before also turning the gun on himself.
German police were alerted within three minutes and despatched two vehicles to the scene where they discovered the bodies of pupils and a physics teacher in her classroom.
"The first policeman heard shots fired on the first floor. They ... went up and caught a glimpse of the gunman, who shot at them and fled," Rech said. "He is then believed to have shot two more teachers in the corridor."
The 17-year-old then cut and ran, shooting dead a person outside a nearby psychiatric clinic before hailing down a Volkswagen Sharan car and forcing at gunpoint the driver to speed off.
Around 30km away in the town of Wendlingen, the car came off the road on a corner. The driver managed to escape and Kretschmer proceeded on foot to a car dealership where he shot dead an employee and a customer.
"The whole time police were on his trail," local police chief Konrad Gelden said.
Cornered in the car park of a neighbouring shopping centre, a shootout between the teenager and the police ensued in which he was shot in the leg, Rech said.
"He fell down, got up again and reloaded his gun. He was found soon afterwards dead," Rech said. State police chief Erwin Hetger said it was believed he then turned the gun on himself.
Two policemen were seriously injured in the fire-fight but they were in a stable condition in hospital, as were seven injured schoolgirls.
German Chancellor Angela Merkel expressed her horror at what she called a "horrendous crime," while Interior Minister Wolfgang Schaeuble said flags would fly at half-mast across the country on Thursday.
"It is a day of mourning for the whole of Germany. Our thoughts go out to the families, the friends. We are thinking of you and we are praying for you," Merkel said.
Rech said there was nothing to indicate that he held a grudge against the school, which he left last year before enrolling on a course to train as a salesman. He regularly worked out at the gym and belonged to a sports club.
"He was completely unremarkable, there was nothing in his background to suggest this could have happened."
Police said the suspect was a German teen who was a below-average student at the school, but managed to graduate last year. A sister still attends the school.
"He was lower than average, and he wasn't engaged in school events," Michelfelder said.
Sabienne Boehm, 12, said she recently met the shooter through a friend, and that he had shown her a note three weeks ago that he then sent to his parents.
"He wrote to his parents that he's suffering and he can't go on," she said.
Boehm told The Associated Press that the shooter claimed fellow students at the high school had mocked him, and that teachers there ignored him.
Teenagers were sobbing and clinging to each other as they left a church service to the victims on Wednesday.
The picturesque town of Winnenden, around 25km northeast of Stuttgart, has around 27,000 inhabitants.
The Albertville-Realschule, which has 600 pupils, was part of a complex of several other schools with a total of 1,700 students aged from six to 19.
It was one the worst school shootings in Germany since April 2002, when 19-year-old Robert Steinhaeuser, a disgruntled student from Erfurt in eastern Germany who had been expelled, killed 16 people and then himself.
Agencies