The gunman was rushed to a hospital in Helsinki with a gunshot wound to his head after Wednesday's shooting at Jokela High School in Tuusula, some 50 kilometers (30 miles) north of the capital.
He was pronounced dead later Wednesday. "There was no hope," said Dr. Eero Hirvensalo, chief of the Toolo Hospital in central Helsinki . "His condition was critical from the beginning."
Police were analyzing YouTube postings that appeared to anticipate the massacre, including clips in which a young man calls for revolution and apparently prepares for the attack by test firing a semiautomatic handgun.
The gunman, who was not identified, shot the victims - five boys, two girls and the female principal - with a .22-caliber pistol, police said, adding about a dozen other people were injured as they tried to escape from the school.
Witnesses described a scene of mayhem in the leafy lakeside community, in which the assailant scoured the school for victims while shouting slogans of "revolution."
Police chief Matti Tohkanen said the gunman belonged to a gun club and got a license for the pistol on Oct. 19. He did not have a previous criminal record, Tohkanen said. "He was from an ordinary family," he said.
Investigators were searching for a possible motive in the YouTube postings that appeared to reveal plans of the deadly attack.
One video, titled "Jokela High School Massacre," showed a picture of a what appeared to be the school and two photos of a young man holding a handgun. Electronic music played in the background with a growling voice singing "I am your apocalypse."
The person who posted the video was identified in the user profile as an 18-year-old man from Finland . The posting was later removed.
The profile contained a text calling for a "revolution against the system."
Another YouTube video clip showed a young man clad in a dark jacket loading a clip into a handgun and firing several shots at an apple placed on the ground in a forested area. He smiled and waved to the camera at the end of the clip.
A third clip showed photos of what appeared to be same man posing with a gun and wearing a T-shirt with the text "Humanity is overrated."
Police said they would investigate any possible connection the gunman might have had to the video.
Kim Kiuru, a teacher at the school, said the principal announced over the public address system just before noon (1000 GMT) that all students should remain in their classrooms.
"After that I saw the gunman running with what appeared to be a small caliber handgun in his hand through the doors toward me after which I escaped to the corridor downstairs and ran in the opposite direction," Kiuru told reporters.
Kiuru said he saw a woman's body as he fled the building.
"Then my pupils shouted at me out of the windows to ask what they should do and I told them to jump out of the windows ... and all my pupils were saved," Kiuru said.
Terhi Vayrynen, 17, a student at the school told The Associated Press that her brother Henri Vayrynen, 13, and his classmates had witnessed the shooting of the principal outside the school through the classroom window.
She said the gunman then came into Henri Vayrynen's class shouting: "Revolution. Smash everything."
When no one did anything, he shot the TV and the windows of the classroom but did not fire at the students. Then he ran out and down the corridor, Terhi Vayrynen said.
Vivianna Korhonen, a student at the high school, told Finnish broadcaster YLE she feared for her life as news of the shooting spread through the school.
"We were terrified and afraid, we thought that we might die, as he (the shooter) was still able to come to our classroom," she said. "We were informed all the time, we were calling our friends and asking for information."
More than 400 students aged 12 -18 were enrolled at Jokela, officials said.
Residents in Tuusula, a town of 34,000 people, said such attacks were unheard of in the area.
"Mostly nothing happens here, this is nice surroundings and not any criminals to talk of. This was a total surprise," said Reijo Pekka, whose son Arttu Siltala was at the school.
Students at the school said the killer often wore the same clothes to school: a brown leather jacket, black trousers and a checkered shirt. He almost always carried a brief case.
Tuomas Hulkkonen, a student at the school, said he knew the gunman well, and that he had been acting strange of late.
"He withdrew into his shell. I had noticed a change in him just recently, and I thought that perhaps he was a bit depressed, or something, but I couldn't imagine that in reality he would do anything like this," Hulkkonen told Finnish TV broadcaster MTV3.
Gun ownership is fairly common in Finland by European standards, but deadly shootings are rare. Finnish media reported that in 1989 a 14-year-old boy shot and killed two students, apparently for teasing him.
Experts warned the Finland shooting could inspire copycat attacks in other parts of the world.
"An event like this in Finland might have an effect in the U.S. ," said Christopher P. Lucas, a psychiatry professor at NYU Medical Center in New York .
He added that YouTube provides a ready way for shooters to publicize their acts and provide some sort of justification.
Prime Minister Matti Vanhanen described the situation as "extremely tragic," and declared Thursday a day of national mourning with flags to be flown half-staff.