ROCHESTER, N.Y. — A western New York man charged in the accidental shooting death of his 2-year-old son in October has pleaded guilty to criminal possession of a weapon.

The Monroe County District Attorney’s Office says 36-year-old Charles Phillips of Rochester left a loaded handgun unattended at home and his son Zayden grabbed it and pulled the trigger.

The child died several days later at Strong Memorial Hospital.

Phillips pleaded guilty to the weapon charge Friday. Under the plea, he’ll serve 12 years in prison.

He was originally charged with second-degree manslaughter.

Authorities say Phillips had served prison time for a robbery conviction and was released in April 2016. As a convicted felon, he was prohibited from owning a gun.