WOODBRIDGE, Va. — In a scene reminiscent of other school shootings, a Northern Virginia Community College teacher spotted a weapon and ducked to avoid gunfire. Students ran from the classroom building while others barricaded themselves inside, piling desks in front of doors.

This time, though, no one was hurt.

Police said Jason Michael Hamilton, 20, opened fire in a classroom Tuesday with a high-powered rifle, but did not hit anyone and surrendered peacefully in a hallway. He was later charged with attempted murder and discharging a firearm in a school zone and was being held without bond.

A neighbor described Hamilton as a loner who lived in his family's basement in an affluent new subdivision near the school in Woodbridge, about 25 miles south of Washington, D.C. Two police cars were outside his home and wouldn't let reporters close.

Whether Hamilton had hired an attorney was not immediately clear; neither was a motive for the shooting.

Prince William County Police spokeswoman Kim Chinn said the unidentified teacher ducked when the student opened fire.

20 desks piled up
In a classroom nearby, biology professor Miriam St. Clair said she heard a loud noise.

"It sounded like a desk fell over and we heard another loud pop, we knew it was a gunshot," said St. Clair, of McLean, Va.

When St. Clair looked out the window, she saw students fleeing. The professor told her students to get inside the classroom and they piled about 20 desks against a door that didn't have a lock. About 2 1/2 hours later, a SWAT team came and told them it was safe.

"We were very frightened," said St. Clair, 58.

Police spokeswoman Sharon Richardson said officers responded about 2:40 p.m. to an "active shooter" following reports of a gunman in the main administration building.

The college enacted its emergency lockdown and later issued a statement saying all Woodbridge classes were canceled. Some students, faculty and staff were sent to a nearby high school.

All classrooms are in one building and the students were in lockdown until about 5:30 p.m. Swat teams went into each classroom during the lockdown, said Chinn, who didn't know how many students were inside or how many shots were fired.

One of the suspect's neighbors said Hamilton's parents moved to the subdivision about three years ago and he sometimes saw the suspect jogging alone, or with his mother.