A 12-year-old Missouri boy shot and killed his friend Tuesday with a gun that belonged to his grandfather, Fox2Now.com reported.

The boy found the gun in an unlocked bedroom at his grandfather`s house in University City, a suburb Northwest of St. Louis, police said. The boy reportedly lived with his grandfather.

The boy who fired the shot told police he was playing with the handgun and it went off, hitting the other 12-year-old boy in the head. The two were friends and classmates.

The boy who was hit was taken to Children's Hospital for treatment. But police said he was pronounced dead in the emergency room. The boys had apparently walked to the home on Westmont from the victim's home about 3:45 p.m. in the afternoon.

Fox2Now.com reported that the boy who fired the shot was taken to authorities in the family court while the investigation unfolds. Investigators say they are treating the case as an accidental shooting.