HELSINKI, Finland — A bullied teenage outcast with radical views scribbled a suicide note bidding farewell to his family before unleashing an indiscriminate killing campaign at his high school, police said Thursday.

As the grim details emerged of a premeditated massacre by a youth consumed with anger against society, stunned Finns mourned the victims of his deadly rampage. Flags across the Nordic nation flew at half staff.

Armed with a semiautomatic handgun and 500 rounds of ammunition, 18-year-old Pekka-Eric Auvinen emptied nearly 20 rounds into some of his eight victims Wednesday, police said.

He also tried to set the school building on fire in what police said was a well-prepared attack that Auvinen had foreshadowed in Internet postings.

Grieving students placed candles outside the sealed-off high school in Tuusula, some 30 miles north of the capital, Helsinki.

A day of mourning was declared and memorial services were held across the country, including in Tuusula, a town of 34,000 people, where a church was turned into a crisis center with experts on hand to offer comfort.

The president attended a memorial service in the capital.

"The violence at the Jokela school center has shocked us to our very core. This unbelievable incident has rendered us speechless in pain and distress," Bishop Mikko Heikka told the mourners in Helsinki Cathedral.

Police said Auvinen left a suicide note "saying goodbye to his family and a message ... indicating his will against society." They said he appeared bent on causing maximum bloodshed as he opened fire.

Police also seized books and other printed material that suggested Auvinen was angry at society and was planning an attack.

"His opinions were extreme and he had radical thoughts," police spokesman Jan-Olof Nyholm said, adding there was no indication Auvinen was affiliated with any political movement.

Investigators believe Auvinen revealed plans for the attack in postings on YouTube in which he urged revolution and grinned after taking target practice with a handgun.

One posting called for a popular uprising against "the enslaving, corrupted and totalitarian regimes."

"I am prepared to fight and die for my cause. I, as a natural selector, will eliminate all who I see unfit, disgraces of human race and failures of natural selection," the posting said.

Finnish media said he posted similar messages in chat rooms just hours before the shooting spree.

Apparently selecting his victims randomly, Auvinen killed six fellow students, the school nurse and the principal before turning the gun on himself, police said. More than 400 students aged 12-18 were enrolled at the school.

"There's nothing that links him with the victims except that they attended the same school," Detective Superintendent Tero Haapala told The Associated Press. "But the explanation can be found mainly in his Web writings and his social behavior."

Haapala described Auvinen as a social outcast who was "bullied in school." He did not provide details but suggested that the bullying may have helped lead to the violent behavior.

"You can say that the motive is still open," Haapala said.

Investigators gave a chilling account of the mayhem, which started just before noon and ended two hours later when police found Auvinen in a bathroom near the school cafeteria with a gunshot wound to his head. He died at a hospital a few hours later.

Police found 69 shells at the scene, suggesting Auvinen fired at least as many shots. The victims were shot in the head or the upper body — some only a few times, others almost 20, Haapala told a news conference.

The killer also tried to start a fire. He doused the floor and walls of the school's second floor in a flammable liquid but failed to ignite it, Haapala said.

Auvinen shot the victims with a .22-caliber Sig Sauer Mosquito pistol, police said, adding that about a dozen other people were injured as they tried to escape from the school.

Police said Auvinen, who had no previous criminal record, belonged to a gun club and got a license for the pistol on Oct. 19. He allegedly bought the gun days before the attack from a local gun store along with 500 rounds of ammunition.

Finland has the highest rate of gun ownership in Europe, and the third-highest in the world, according to the Geneva-based Small Arms Survey, but gun violence is relatively rare.

While some international gun-control groups linked the school shooting to the availability of firearms in Finland, there were no immediate calls for stricter gun laws in the Nordic nation.

The Interior Ministry said Finland has some 650,000 licensed gun owners — about 13 percent of the population of 5.2 million — many of them hunters.