A 4-year-old boy shot and killed his 2-year-old cousin at a home in Muscoy, California, according to local authorities.

The victim's grandfather, Cesar Lopez, 53, was arrested and charged with child endangerment and being a felon in possession of a firearm, the San Bernardino County Sheriff's Department announced on Twitter.

Deputies responded to a report of a shooting at the home Friday morning. The victim, a 2-year-old girl, was found suffering from a gunshot wound and was taken to a local hospital where she was pronounced dead, the sheriff's office said.

An investigation determined the shooting to be accidental but also revealed Lopez had left the gun "in an where it was accessible to the children," the sheriff's office said in a statement.

It was unclear Friday evening whether Lopez has an attorney.