(Scott Olson/Getty Images)

Police have recovered a gun they said was fired inside a classroom at a Northern Virginia high school Tuesday afternoon, authorities said.

No one was injured when the gun was discharged in an art classroom as a student was showing the weapon to other students at Hylton High School in Woodbridge about noon, Prince William County police said.

It was not immediately apparent to the students and a teacher in the class that a weapon had been discharged but there was a recognition of a loud noise occurring near a student who initially was not cooperative with officials, police said.

Other students who witnessed the incident also were not immediately forthcoming, police said, and students remained in their classrooms for hours as authorities searched for the firearm.

A 16-year male student was charged with possession of a firearm on school property, Prince William County Police said in a news release.

Prince William Police Chief Barry M. Barnard told reporters shortly after 4:30 p.m. that students remained inside their classrooms because police had not found the gun.

A news release from police sent about a half-hour later said the weapon was recovered and students would be dismissed shortly.

Barnard said a student had taken out the gun in a classroom and was displaying it when a round discharged, ricochetting off two or three different places.

School staff found a trash bin with “damage consistent with a bullet striking it,” the release said. Bullet fragments were also discovered in the ceiling, police said in an earlier news release.

“Once the nature of the incident was discovered, police and school officials quickly identified and detained the student involved,” the release said. “All students and staff are safe inside the building and multiple police resources are on scene.”

The school system directed parents to Forest Park High School to wait for information about students’ dismissal.