Updated

Investigators were trying to identify a gunman who invaded a Finnish vocational school Tuesday and executed 10 students before turning the gun on himself.

Police were also looking into reports that days earlier the gunman had posted a video of himself taking target practice at a local range.

The shootings began just before 11 a.m. local time as about 150 students went to class in Kauhajoki, 180 miles northwest of Helsinki. Witnesses said panic broke out as the hooded gunman entered the school and began firing.

"Within a short space of time I heard several dozen rounds of shots, in other words it was an automatic pistol," school janitor Jukka Forsberg told broadcaster YLE. "I saw some female students who were wailing and moaning and one managed to escape out of the back door."

Click here for photos.

Click here to watch YouTube video of alleged gunman.

Police spokesman Jari Neulaniemi says the gunman left two handwritten messages at the school dormitory saying he had planned the attack since 2002 and that he hated the human race.

Neulaniemi, who is heading the investigation of Tuesday's shootings, said he had also written that the solution was a Walther 22, referring to the .22-caliber pistol he used in the attack.

Neulaniemi said the 22-year-old attacker, who was a student at the school, had lit several fires at the school with "some petrol bombs or Molotov cocktails, or something like that."

Finland's interior minister said the shooter was questioned by police a day before the massacre but released.

Anne Holmlund says the gunman was detained for questioning on Monday about YouTube postings in which he is seen firing a handgun. She says police released him because they had no legal reason to keep him detained.

She says the man used a 22-millimeter caliber handgun in Tuesday's attack. Holmlund says he got the license for the gun in August.

Jussi Muotio, superintendent of the Kauhajoki police, confirmed that several people had been wounded but could not immediately confirm the deaths. "The incident is over now," Muotio said.

The gunman, a student at the school in the town of Kauhajoki, opened fire inside the building for some time before he shot himself, police said.

Rescue personnel around the school had been unable to help while the student was continuing to fire in the building, said rescue squad coordinator Kari Saarinen, chief physician at Senajoki Hospital.

College rector Timo Varmola told YLE there were 150 students in the school at the time.

The shootings happened almost a year after another gunman killed eight people and himself at a school in southern Finland, an attack that triggered a fierce debate about gun laws in this Nordic nation with deep-rooted traditions of hunting in the sub-Arctic wilderness.

With 1.6 million firearms in private hands, Finland is an anomaly in Europe, lagging behind only the United States and Yemen in civilian gun ownership, studies show.

Finnish media said YouTube clips of a man firing a gun appeared to be linked to the shooting. In one of them, a young man wearing a leather jacket fires several shots in rapid succession with a handgun at what appears to be a shooting range.

The posting was made five days before the shooting and the location was given as Kauhajoki. The posting included a message saying: "Whole life is war and whole life is pain. And you will fight alone in your personal war."

The person who posted the clip identified himself as a 22-year-old with the name "Mr. Saari." He also posted three other clips of himself firing a handgun in the past three weeks.

Clips from the 1999 Columbine school shootings in Colorado were listed among his favorite videos.

Police could not immediately confirm whether the postings were linked to Tuesday's shooting.

Last year, Pekka-Eric Auvinen, described by police as a bullied 18-year-old outcast, opened fire at his high school in southern Finland on Nov. 7. He killed six students, a school nurse and the principal before ending his own life with a gunshot to the head.

Finnish investigators have said Auvinen left a suicide note for his family and foreshadowed his attack in YouTube postings.

After Auvinen's rampage, the government said it would raise the minimum age for buying guns from 15 to 18, but insisted there was no need for sweeping changes to Finland's gun laws.

The Associated Press and Reuters contributed to this report.