The Prince William County boy who ambushed his middle school on the last day of classes and threatened to shoot people with a high-powered rifle pleaded guilty yesterday to abduction and weapons charges and could be held in a juvenile facility until he is 21.

The seventh-grader, now 13, pleaded guilty to three felonies, while two other charges, including conspiracy to commit murder, were dropped.

The hour-long hearing in juvenile court was closed to the public because the boy is younger than 14. When it was over, Prince William Commonwealth's Attorney Paul B. Ebert said he will probably ask the judge at the Sept. 29 sentencing to order the boy held until he is 21 -- the maximum punishment.

"This is the kind of case that could have been very dangerous. . . . The message has been sent," Ebert said at a news conference outside the courthouse. "Had it not been for the police work, it could have been worse. They acted in the face of danger, willing to risk death or bodily harm."

A second boy was charged as a co-conspirator who backed out of the plan at the last minute. But prosecutors yesterday dropped the charge of conspiracy to possess a firearm on school property.

Ebert said it was difficult to determine whether the boys had reached "an actual agreement," an element necessary to make up a conspiracy.

Attorney Jim Hundley said his client was one of several students who had heard the gunman discuss his plans, but no one took him seriously. He said the second boy, who is 13, was the only other student charged in the incident because he "said things that led police to believe that he hadn't backed out because he wasn't as sophisticated as the other kids" when talking to police after the incident. "The police may have acted overly aggressive and given the circumstances, that's understandable," Hundley said.

Authorities and witnesses have described the final day of classes at Bull Run Middle School on June 18 as harrowing. The boy was subdued without a death, an injury or a single shot fired, they said.

The 12-year-old boy brought three guns, a knife, flammable liquid and more than 100 rounds of ammunition when he was driven to school that morning by his mother, Naomi Lewis, a cafeteria worker at the school. Lewis, 38, discovered the weapons rattling around in the back of her van but left them locked inside without alerting authorities. She has been charged with possession of firearms on school property and faces an Oct. 6 trial.

As students began arriving for school that day, her son went back to the van and opened it with a key his mother didn't realize he had, police said. He took the bag of weapons to a bathroom next to the school's office, changed into camouflage gear and cloaked his face in a red bandana. An assistant principal conducting a routine check heard him loading a rifle and rushed into the office to call for help.

About 8:30 a.m., the boy burst into the office, ordered the dozen or so people to "get down" and pointed his weapon at a woman crouched underneath a desk using a telephone to call for help, according to a witness. School officials ordered a "code red," and the building was locked down, procedures devised after the Columbine school shootings in Colorado in 1999. Mark Arnett, a technology education teacher, confronted the boy and talked him out of using his weapon about 10 minutes before police made the arrest.

The Lewis family declined to comment. Friends and neighbors said the boy was bullied incessantly at school and speculated that his actions were retaliatory.

Ebert said yesterday's hearing before Judge Janice Brice in Juvenile and Domestic Relations Court began with the boy entering his guilty pleas to abduction, possession of a firearm on school property and use of a firearm in commission of a felony. Prosecutors then played a school surveillance video that shows much of the incident, he said.

William G. Bixby, the principal of Bull Run Middle School, said "students will listen" to the message sent by the outcome in the courtroom because it shows "there are consequences for such a serious action that had such a disruptive impact on our community." It is unclear whether the two boys charged in the attack would be allowed back into the school system, he said.

Parents and students said the boy's guilty pleas provide some much-needed closure.

"I just feel bad that it came to this point," said Ginger Treague, 40, a parent who was held hostage in the office with her two sons. "I am not angry with the mother. I don't think she truly believed her son was going to do something like this. I am just hoping he gets the help that he needs and a good education and can go and become a successful human being."

Said Alex Strittmater, an eighth-grader, who along with his brother taped construction paper over their classroom window so the boy with the gun wouldn't see them: "I don't think he should be allowed back into the school system. We don't know if he we can trust him."

Commonwealth's Attorney Paul B. Ebert and assistant commonwealth's attorney Claiborne Richardson meet media.