A Magruder High School senior had a handgun in his backpack on school grounds Thursday morning, officials said.

The 17-year-old boy was charged as an adult with possession of a weapon on school property and other weapon-related charges, Montgomery County police said.

The student was not supposed to be on school property Thursday because he was suspended. But shortly before 8 a.m., he was spotted on the grounds of the school, located at 5939 Muncaster Mill Road in Rockville. When a school resource officer asked the teen to leave, the student refused and arrested on a trespassing charge.

After the arrest, an "older," unloaded, .22-caliber H&R handgun was found in the student's backpack, police said. Authorities are examining the firearm to determine whether it is operable. No ammunition was found with the weapon, and no one was injured during the incident.