Prince William County school officials said the armed seventh-grader who entered a Bull Run Middle School, apparently intent on settling scores with classmates who bullied him, was caught quickly and safely because everyone involved followed a well-rehearsed emergency plan.

Annual drills meant that teachers knew to order students under their desks and lock classroom doors at the first indications of trouble over the public address system. The first police officers to arrive knew the building's layout and knew they should go inside as soon as there were five of them, rather than wait for backup. As soon as the incident was over, school personnel began arranging buses to take students to nearby Tyler Elementary School.

"They did a well-practiced lockdown, and they did that very well," said Donald Mercer, the school system's director of risk management and security. "That's the most important thing that we did."

But the day that didn't end in tragedy was not without flaws. At a meeting with parents Thursday night, school officials acknowledged there were lessons to be learned and applied in case there is a next time. Internally, they said, the chain of command became slightly tangled. Externally, some parents had trouble finding out what was going on and understanding what was being done to protect their children. And some children and parents who had heard something about the student's intentions had not told school officials.

School Board Chairman Lucy S. Beauchamp (At Large) said that in addition to being thoroughly prepared, "we were very, very lucky." But "we need to take what the parents said -- good, bad or indifferent -- and update the crisis plan."

Though parents came to Thursday's meeting with concerns, the mood was mostly one of gratitude. They gave standing ovations to the police and Principal William Bixby, who in turn thanked his staff for its performance and students and parents for their understanding. "The actions of a number of individuals were quite remarkable," said Bixby, who recalled telling his students often that "we never know where or when or why we're going to implement" the emergency plan, that the point "is just to be ready."

Prince William schools have had an emergency plan for decades. But in the past several years -- particularly since the fatal shootings at Columbine High School in Colorado in 1999 and the 2001 terrorist attacks -- there has been a concerted effort to update policies and make sure everyone is trained, Mercer said.

The emergency plan, contained in thick binders, describes what should be done in events as wide-ranging as "aircraft disaster" to "workplace violence," Mercer said. Each principal can modify the plan for a school's circumstances, and the specifics are revealed only to those who need to know. Each summer, the plans are reviewed and police conduct drills in schools so they can become familiar with their layouts.

"It sounds as though they planned and had personnel who are able to think on their feet," said Kenneth A. Trump, president and chief executive of National School Safety and Security Services in Cleveland, a consulting firm on school security, crisis preparedness and youth violence.

Trump said Columbine prompted school districts across the country to devise crisis plans, many of which are now "collecting dust."

"You don't just have a crisis plan on paper for the sake of having one," he said. "You have to plan, prepare and practice."

According to police, the 12-year-old student arrived at Bull Run on June 18, the last day of school, with his mother, a school cafeteria worker. Just before school started, he returned to the family's minivan, where he allegedly had stashed three rifles in a blue nylon bag. Police said his mother had seen the weapons earlier and locked them in the van but did not tell anyone and did not know that her son had a car key. The boy retrieved the weapons and headed for a restroom usually used by adults near the main office.

Assistant Principal Jamie Addington, making routine rounds, heard the sound of a weapon being loaded in one of the stalls, peeked into the stall and saw the boy putting a cartridge into a 30.06 rifle. Addington ran to the office, where there were about a dozen employees, students and parents, and told them to call 911. He alerted other school personnel by walkie-talkie and left the office.

Witnesses said the student came into the office, followed shortly by two teachers who saw what was happening and ran out, pursued by the student. Everyone else in the office locked themselves in a restroom.

Bixby and Addington returned to the office, where they announced an intruder alert over the public address system. Bixby went out his ground-floor office window with a school roster and told students outside to run to nearby homes. Police prevented him from going back inside, he said.

Prince William Police Chief Charlie T. Deane said every officer, from recruits to the highest ranks, is trained to respond to weapons situations and to enter as soon as five officers are on the scene. At Columbine, police were criticized for waiting for the assault to end. "The initial response is just to be fast and overwhelming," Deane said.

The officers entered the lobby and saw a teacher trying to persuade the boy to disarm. The teacher positioned himself so the boy could not see the officers, then obeyed their hand signals to get out of the way as they surrounded the boy.

Though many parts of the emergency response plan unfolded as prescribed, some parents said it was difficult to get information. "I spent the day happy and stupid in an operating room, and when I got home, I had no idea what went on," said Laura Kish, a Bull Run parent who is a nurse.

"The big thing we need to do is find a better way of communicating with parents," said School Superintendent Edward L. Kelly. He said police are supposed to get the word out. "The difficulty is when you wait for that to happen, no one is notifying parents with what is happening with that individual child."

Bull Run has an auto-dialer system -- which can contact parents with a message -- but no one was able to get back into the school to activate it for hours, as police searched the school room by room. Beauchamp said school staff now know how to operate some parent notification systems remotely.

Beauchamp said students were told not to use their cell phones, so as not to block signals for emergency workers, though some did. Mercer "several times couldn't get his cell phone calls to go through on the site," she said.

Although the plan says top school officials should stay at a command center at School Board headquarters, Kelly headed for the school. "I don't know what I was going to do," he said. "I just know I wanted to get to the scene."

He later told School Board members that Mercer let him know he was out of place and interrupting the chain of command.

Several students said they knew of the 12-year-old's plot but dismissed it as a joke. Several said the boy was constantly picked on because of his clothes, his weight and his glasses, but school administrators said they had no indication of this from teachers, counselors or the child's parents.

"There's a lot of kids out there that are ticking, and they're ticking for the same reason this kid was ticking," said Joseph Harpold, a retired FBI analyst who worked with the police department and school on its emergency plan.

Beauchamp said students "need to know if they hear anything, no matter how ludicrous it may sound, they need to report that."