The gun involved in a 9-year-old Grays Ferry boy's accidental self-inflicted shooting Thursday night was legally purchased, Philadelphia police said Friday.

The boy was wounded when he found the handgun in his parents' bedroom and accidentally shot himself in the left ring finger, police said.

The incident happened at the family's home on the 1500 block of South 32nd Street just before 10 p.m. Thursday.

The child was taken to Children's Hospital of Philadelphia for treatment and has been released, police said Friday.

Police said the gun was legally purchased but didn't disclose who owned it. Authorities said details of the incident, including why the firearm was accessible to the child, remain under investigation.