WINNENDEN, Germany — The 17-year-old had no criminal record and authorities say he was barely noticed in school until he returned Wednesday with a handgun.
Entering the high school where he graduated last year, he burst into morning classes and opened fire, taking students and teachers by complete surprise.
"Children were sitting at their tables, with pencils still in their hands, their heads fallen over on the table," said regional police director Ralf Michelfelder, describing the grisly scene that his officers found. "Most of them had shots in their head — it must have all happened in seconds."
Local media identified the shooter as Tim Kretschmer.
The gunman went to three classrooms, killing nine students and three teachers before fleeing the building when police arrived.
"Our officers were very quick," said Baden Wuerttemburg state Interior Minister Heribert Rech.
There was no immediate indication of motive, but the victims were primarily female: Eight of nine students killed were girls, and all three teachers were women.
Friend Fabienne Boehm, 12, said that she recently met Kretschmer and that he had claimed fellow students at the high school had mocked him and teachers there ignored him.
Three weeks ago, she said he showed her a note. "He wrote to his parents that he's suffering and he can't go on," she said outside a memorial service late Wednesday.
Kretschmer apparently took the weapon from his father's collection, police said. His father was a member of the local gun club and kept all the weapons locked away except for the pistol.
After fleeing the school, the shooter ran into downtown Winnenden, a town of 28,000, where he shot two pedestrians, killing one, police said.
He then hijacked a car and forced the driver to head south, triggering a land and air search involving 700 police officers and four helicopters, prosecutors said. The driver eventually managed to escape, and the suspect fled.
He entered a car dealership, where he shot and killed a salesman and a man shopping for a car and then went back outside, prosecutors said.
He opened fire on police swarming the area. They shot back and hit the suspect, who fell to the ground, Michelfelder said.
But he got back up, reloaded his weapon and fled into what turned out to be a dead-end street. Police found him there dead, having apparently shot himself in the head.