A 14-year-old boy was arrested in the US after holding 27 classmates and a teacher hostage at gunpoint. The teenager held the students captive for an hour in a second-floor classroom at Philip Barbour High School in the city of Philippi, West Virginia.

The boy, who has not been identified, walked into the classroom and pointed a pistol at the teacher, Superintendent Jeffrey Woofter wrote in a prepared statement released by The Exponent Telegram.

"The teacher did a miraculous job of calming the student down and maintaining order in the class," he wrote. "The school bell rang, and the teacher talked the student with the gun into not allowing any new students into the classroom. She met them at the door and told them not to come in."

The students, who were told not to enter, went across the hall to another classroom and told a second teacher they had been sent away. When the second teacher went to the classroom to see what was transpiring, she was also confronted by the boy pointing the gun at her. She slammed the door shut and returned to her room where she called the main office, who called 911 at approximately 1.30pm.

Police said the school was put in lockdown as the drama unfolded and the rest of the students were evacuated to a football field, as trained negotiators talked to the boy. They were able to convince him to release the teacher and his peers. He was then persuaded to drop the weapon and surrender to authorities. Police said the boy was taken to a hospital to be evaluated as authorities attempted to determine a motive. A youth pastor at the school has reported that the boy was being bullied.

Barbour Country Superintendent Jeff Woofter praised the two teachers for their heroism. "We want to thank both of the teachers involved and the students in the room for their heroic actions," Woofter said. "We also want to thank the entire administration, faculty, staff and student body at Philip Barbour High School for their actions in a very trying situation"'

"In such a trying time, I was just amazed at our parents and how everybody responded. I thank god that everybody is safe, and hopefully we'll never have a repeat of that again," he added.

Further details, including where the boy acquired the weapon, were not immediately provided by the authorities. State Police Capt. Dave Reider said that the investigation into the incident is still ongoing and that he couldn't reveal if shots had been fired.

Philippi is a city of some 3,000 residents about 130 miles south of Pittsburgh.