The boy appeared in court on school weapons charges and was sentenced to home confinement.
But his dad defended his son, claiming the gun was harmless because the firing pin had been removed.
Officials said the boy arrived at his elementary school in Hunter's Creek, Florida, with the pistol, a steak knife an sledge hammer in his backpack. He also had several bullets.
The boy told three friends about the weapons he was carrying, who told a school resource officer and police were called.
The boy was charged with possession of a firearm on school grounds, possession of a concealed weapon and possession of a firearm by a minor.
His father said his son would not have harmed anyone and was simply acting out a character he learned from his favourite game Minecraft.
"They use hammers to dig and knives and guns to protect themselves from zombies," the boy's father told local TV news.
He said the gun came from his home and had been taken from a drawer but insisted it was harmless as the firing mechanism had been disabled. The judge ordered the boy to stay away from school.
The video game Minecraft, rated E (for everyone), has multiple modes such as survivor, creative and adventure that allow players to build their own worlds and act as they choose.
It also features 20-minute life cycles divided into night and day, and at night, animals, zombies and other creatures attack the player unless they are killed by a multiple array of weapons available in the game.
Suggested For You
SUBSCRIBE AND FOLLOW
Get top stories and blog posts emailed to me each day. Newsletters may offer personalized content or advertisements.Learn more