A photo of the gunman in military fatigues on his website where he left a farewell note.
Armed with rifles, pistols, pipe bombs, a knife, smoke canisters and wearing an explosive belt, the 18-year-old former pupil stormed into his school and opened fire, wounding 11 people, five through gun shots.
The man, who has not been named, started shooting even before he entered the Geschwister-Scholl junior high school in the town of Emsdetten at 09:30 on Monday morning wearing a combat mask and clad in black.
Once inside he was confronted by a woman teacher and shot her in the face with a non-lethal gas-powered gun. When the school's janitor came rushing to her aid he shot him in the stomach with another gun. The janitor is in hospital in critical condition.
He went on to shoot four pupils -- three boys and a girl aged between 12 and 16 years -- and wounded them with shots in the chest, stomach, arm, knee and hand.
There were scenes of chaos as alarmed parents gathered outside the school and children fled out of the building. Armed police first tried to negotiate with the man but then decided to storm the school. He set off smoke canisters and several officers sustained smoke poisoning.
They found him on the second floor, his face mangled either by a shot from his own gun or by the detonation of one of the explosive devices strapped to his body, police said.
Explosives experts had to be brought in to defuse his suicide belt and four pipe bombs he had planted around the school.
Two rifles with sawn-off barrels were next to him. State prosecutor Wolfgang Schweer said the pupil had killed himself and was probably motivated by "general frustration and a felling his life had lost all meaning." He had been due in court on Tuesday for illegal possession of weapons. His father collapsed and was taken to hospital after hearing about the shooting. The mother is in shock.
He left a farewell note on an Internet page which has been taken off line. Police believe the note to be genuine. "The only thing I learned intensively at school was that I'm a loser," he wrote. "I loathe people."
The website showed him posing in combat gear and holding weapons, among them a submachine gun. The letter ends with the words: "I am gone."
Fellow pupils said he had been good in school but had increasingly turned into a loner from the eighth grade when he started wearing black clothes and listening to Death Metal music. He said he wanted to join the army.
He would spend all day playing computer games. He got a reputation for being unpredictable and started behaving menacingly towards local girls.
The shooting brings back memories of the Erfurt school massacre in April 2002 when former pupil Robert Steinhäuser shot dead 13 teachers, two pupils, a police officer and himself in Germany's worst shooting since World War II.
The Erfurt case prompted calls for tougher controls on violent computer games.