SAN BERNARDINO, Calif. — A 4-year-old boy accidentally shot and killed his 2-year-old cousin Friday at a home in Southern California and deputies arrested the victim’s grandfather for allegedly leaving the gun where the kids could find it, authorities said.

The girl died at a hospital shortly after the mid-morning shooting in the Muscoy area, east of Los Angeles, according to San Bernardino County sheriff’s spokeswoman Cindy Bachman.

Cesar Lopez, 53, was taken into custody later in the day on suspicion of child endangerment and being a felon in possession of a firearm, the department said. It wasn’t immediately known if he has an attorney.

The boy got hold of the gun and accidentally fired it, striking his cousin, officials said.

Investigators determined Lopez “left the gun in an area that was accessible to the children,” a department statement said.

Adults were home at the time of the accident, Bachman said. Both children lived at the house.