A teenager accused of plotting a massacre at his suburban Detroit (search) high school was sentenced Thursday to at least 4 1/2 years in prison for threatening terrorism and amassing an arsenal in his home.

"Though he has to pay the piper, we want to give him as much a chance for salvation as we can," Circuit Court Judge Matthew Switalski (search) said in sentencing Andrew Osantowski. "You still have a future."

Osantowski, 18, wept while the judge spoke.

"I look back and realize how lost I was," he told the court before he was sentenced. "I am truly sorry for the things I have done. My family never raised me like this."

The case appears to be among the first in the nation in which anti-terrorism laws were applied to school violence, according to law enforcement officials.

Osantowski was found guilty last month of threatening an act of terrorism and using a computer to threaten terrorism after authorities found Internet chat room messages in which he wrote that he might kill students at Chippewa Valley High (search).

Each charge was punishable by up to 20 years in prison.

Osantowski also was convicted of receiving and concealing guns and possessing a firearm in a felony.

Osantowski was arrested in September after a girl he had written to in the chat room shared the messages with her father, a police officer. In some of the messages, Osantowski said he was bullied at school and at home and wanted to take revenge.

"I can't imagine going through life without killing a few people," he wrote.

A search of Osantowski's home yielded weapons, ammunition, bomb-making paraphernalia, videotapes showing the teen in possession of assault weapons, a Nazi flag, and printed materials about Adolf Hitler and white supremacy.

His lawyer argued the jury never should have been allowed to see the weapons.