Thirty-year veteran teacher Twila Smith had scarcely begun the school year when a 14-year-old freshman entered her class and pulled a gun. He told her to cover the windows, lock the door and throw the keys and her 27 students' cellphones on the floor.

Smith said if she lost her composure, she knew things would end badly.

While the boy held them hostage for at least 45 minutes Tuesday, Smith says she spoke with him about personal loss, tried to divert attention from the students and kept him talking. He also talked about shooting himself.

Police eventually persuaded him to free his hostages and the boy surrendered.

No one was hurt at Philip Barbour High School in Philippi, 115 miles south of Pittsburgh.

The school superintendent called Smith's actions "miraculous."