The 11-year-old is a student at West Kearns Elementary School, in Kearns, Utah, a suburb of Salt Lake City, and brought the .22-caliber handgun to school in his backpack, Granite School District spokesman Ben Horsley told NBC News.

The boy, whose name has not been released because he is a juvenile, indicated that he wanted to defend himself if there was an incident similar to what happened in Newtown, Conn. Last Friday, 20 students, ages 6 and 7, and six school staff members at Sandy Hook Elementary School were killed when a gunman burst into the school and opened fire before fatally shooting himself. The gunman had killed his mother earlier that day.

“Obviously that’s not the correct approach,” Horlsey said of the 11-year-old's action. “We teach these kids on a regular basis that they have a responsibility to keep their school safe.”

Some witnesses have said they saw the boy brandish the gun on the playground and point it at another child's head. Other reports said the boy verbally threatened another student with the gun. Police have not yet been able to confirm these accounts, Horsley said, noting that it's sometimes difficult to sort out the facts when all the witnesses are children.

Horsley said two of the boy's classmates complained to a teacher at about 3 p.m. MST, about 45 minutes before the end of the school day. The teacher immediately secured the boy and took him to the principal's office. It was the principal who retrieved the boy's backpack from his classroom and contacted Granite School District police. Police were able to find the weapon and secured the situation in three to five minutes, Horsley said.

The boy also had ammunition, although the gun was not loaded and it was not immediately clear whether the bullets were the appropriate ammunition for the gun, Horsley said.

The student was charged with one count of possession of a dangerous weapon on school property and three charges of aggravated assault, which is a third-degree felony, involving the alleged waving of the weapon at other students in a threatening manner.

Horsley said the student obtained the gun at home from an extended family member who moved out of the family’s house last week.

Previous reports indicated that the student claimed his parents told him to bring the gun to school for protection. Horsley said those claims are not accurate and said the parents have been "very cooperative.”

Horsley said the student is likely to face severe criminal penalties, adding that he was suspended from the school and will not be let back into the traditional school setting ever. “We have a variety of alternative placements for kids who violate school safety policies,” Horsley said.

No one was injured in the incident, and the school was not placed on lockdown, school administrators said, because the situation was resolved immediately, and, more importantly, they feared startling students.