The child brought the pistol into his classroom on Tuesday in the town of Bruay-sur-l'Escaut, north eastern France.
While the gun was not loaded and nobody was hurt, teachers took the matter seriously and reported the matter to police.
The owner of the gun, the boy's father, was sentenced on Thursday to prison for possession of arms and endangering the lives of others. He was also fined several hundred euros.
The 36-year-old man had a long criminal record, reported BFM TV, with a string of offences in both France and across the border in Belgium.
His two sons, aged 7 and 9, have been taken into protection.