A student was taken into custody after bringing a loaded gun into Fels High School in the Summerdale section of Philadelphia, according to school officials.

Officials say the gun was found in a 15-year-old student's backpack as it went through metal detectors at the entrance of the school Monday morning, 6ABC.com.

The .40 caliber Smith & Wesson handgun, fully loaded, set off an alarm when the backpack went through a metal detector, police said.

The 9th grade student was immediately taken into custody, said Philadelphia Police Capt. Sekou Kinebrew.

The student admitted to police that he had stolen the gun from a car near his home sometime during the past week, Kinebrew said.

He has no disciplinary problems and no criminal record.

Police were working to determine if a rumor that the student had been beaten up and brought the weapon to school for protection is accurate.