The 17-year-old, named locally as Tim Kretschmer, was dressed in black combat fatigues. He killed nine children and three teachers when he targeted a particular classroom at the secondary school.
A gardener at a nearby psychiatric clinic was shot as the masked teenager fled the Albertville Realschule in the picturesque town of Winnenden, then he hijacked a car, telling the shocked driver "get me out of town".
After allowing his hostage to get out of the VW Sharan on an autobahn, the killer, drove 25 miles to Wendlingen.
There he staged a last stand in the car park of a supermarket, where two passers-by were shot. The gunman was finally killed in a shoot-out with police at 12.30pm (11.30GMT) on Wednesday.
Police sources said the gunman, who left the school last year, was previously known to them, having reportedly had a long history of troublemaking.
The massacre began at 9.30am (8.30GMT) when the killer walked into his old school and began firing without saying a word.
"He went into the school with a weapon and carried out a bloodbath," said regional police chief Erwin Hetger. "I've never seen anything like this in my life."
Many others were injured during the two-minute shooting spree, before the gunman fled.
Police spoke of classrooms and corridors "running with blood" and an appeal went out to local people to donate blood for transfusions for the wounded.
Frank Nipkau, editor of a local paper, said: "He went in there and started shooting immediately. He was shooting in a certain class, a ninth or tenth grade class. We are told that it is a gruesome sight. He just opened up at random."
The entire town of 27,000 inhabitants was locked down, with residents told not to leave their homes, as hundreds of police and armed commandos using helicopters and dogs searched the area for the killer.
Police were immediately informed of the suspect's identity by teachers at the school, who described him as a disgruntled former pupil.
More than 1,500 students were in the school when the bloodbath began, and witnesses said girls and boys of secondary school age were among the victims.
According to one report, police seized at least 18 legally-held weapons from the boy's home, where his family kept a "small arsenal" of rifles which they used for hunting.
Mr Nipkau added: "This is a small town of 27,000 people, an idyllic place, green with mountains, and it's unbelievable that this is happening in this town. We can't understand it."
All schools in the region were closed down and police issued an urgent bulletin to motorists not to pick up hitchhikers while the gunman remained on the loose.
Meanwhile, residents of Winnenden used the Twitter website to post what purported to be minute-by-minute sightings of the gunman.
Psychologists were brought in by local authorities to deal with the shocked survivors who stumbled, many of them in tears, through the school gates.
Winnenden, which is about 12 miles northeast of Stuttgart, is best known as the headquarters of the pressure washer manufacturer Karcher, which has its headquarters in the town.
School shootings have been on the rise in Germany in recent years. The worst occurred in April 2002 when expelled student Robert Steinhauser gunned down 16 people before turning his gun on himself.
In 2006, a masked man wearing explosives and brandishing rifles opened fire at a school in the western German town of Emsdetten, wounding at least 11 people before committing suicide.
The shooting happened after news that in the United States, at least 10 people including the suspected gunman and his mother were killed in a shooting spree and car chase in southern Alabama on Tuesday.
|Liveleak on Facebook|