Eight people have been killed and at least 10 others injured in a shooting at a school in southern Finland, police have said.
The gunman shot himself in the head and later died from his wounds in hospital, officials said.
The shootings took place in Tuusula, some 50km (30 miles) north of the capital, Helsinki.
Finnish police said an 18-year-old man killed five boys, two girls and the female principal of Jokela High School.
Investigators have reportedly identified the gunman as Pekka-Eric Auvinen.
A teacher said the gunman, who had posted footage foreshadowing the massacre on video-sharing website YouTube, was a student at the school.
Police responded to a call made at 1144 (0944 GMT) and made contact with the gunman when they arrived at the school 11 minutes later, said Timo Leppala, the officer in charge of the police operation.
"Police ordered him to surrender, to which he answered by shooting towards the police," Mr Leppala said.
He described a scene of chaos with students jumping from school windows and running for shelter as more police arrived.
It is not clear when the gunman shot himself in the head.
FINLAND GUN FACTS
5.2 million population
World's third highest gun ownership
56 guns per 100 people
Low rate of gun violence
Guns used in 14% of homicides
Police said he was armed with a .22 calibre pistol for which he obtained a license on 19 October. He did not have a criminal record and "was from an ordinary family," a police spokesman said.
A Tuusula municipality spokeswoman said the gunman opened fire during a lesson at Jokela secondary school, which has 400 pupils between 12 and 18.
Kim Kiuru, a Jokela teacher, said the head teacher announced over the school public announcement's system just before noon (1000 GMT) that all students should remain in their classrooms.
"I stayed in the corridor to listen to more instructions having locked my classroom door," Mr Kiuru told Finland's YLE radio.
"After that I saw the gunman running with what appeared to be a small calibre handgun in his hand through the doors toward me after which I escaped to the corridor downstairs and ran in the opposite direction."
"It felt unreal - a pupil I have taught myself was running towards me, screaming, a pistol in his hand."
Mr Kiuru said he saw a woman's body as he fled the building. He said he then told his students to "jump out of the windows... and all my pupils were saved".
The gunman had posted a video called "Jokela high school massacre 11/7/2007" on YouTube in the past two weeks.
The killings have shocked the community
The video showed a picture of a building by a lake and photos of him holding a gun.
Going by the username Sturmgeist89, he called himself a "social Darwinist" who would "eliminate all who I see unfit". "Sturmgeist" means storm spirit in German.
The video has now been removed from the website.
He had also reportedly posted on another website a rambling manifesto.
In it he said: "death and killing is not a tragedy... Not all human lives are important or worth saving."
He wrote that he was acting alone and nobody is to blame for his actions. "This is my war: one man's war against humanity, governments and weak-minded masses of the world."