Updated

A teen accused of plotting a massacre at his suburban Detroit high school pleaded guilty Thursday to several firearms charges — a day before his Internet terror trial is set to begin.

Andrew Osantowski (search), 17, faces charges of making a threat of terrorism, using a computer to make threats of terrorism and possession of a firearm in a felony. Opening statements are scheduled for Friday.

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

Police arrested Osantowski in September after discovering Internet chat room messages in which the teen allegedly threatened to kill students at Chippewa Valley High School (search). The messages were sent to Celia McGinty, an Idaho girl who alerted her father, a university police officer. He contacted Michigan authorities.

During a search of Osantowski's home, authorities found weapons, ammunition, bomb-making paraphernalia, Nazi flags and books about white supremacy and Adolf Hitler. The teenager's father and a man accused of giving the boy bomb-making instructions were also arrested.

Osantowski had attended the school for less than three weeks before his arrest.

Defense attorney Brian Legghio said the teen's pleas to three counts of receiving and concealing stolen firearms should limit the amount of evidence prosecutors may introduce on the remaining charges.

Macomb County Circuit Judge Matthew Switalski has already thrown out most of Osantowski's confession, saying police coerced him. The judge ruled earlier Thursday that the Nazi flag and literature from the boy's home could not be entered as evidence.

Switalski rejected, however, a motion to amend the transcripts of Osantowski's e-mails by changing his client's name to "Andrew" from the screen name "Nazi-botsadistic."

The terrorism counts are punishable by up to 20 years in prison; the felony firearm charge carries a two-year mandatory sentence. Each firearms charge to which Osantowski pleaded guilty is punishable by up to 10 years.

A sentencing date won't be set until after the trial.