A 5-year-old boy inadvertently shot his 4-year-old neighbor while the two were playing at a Hillcrest Heights playground Thursday, authorities said.

Scared by what had happened, the boy then ran into his family’s apartment and hid the gun, authorities said. Police eventually recovered the weapon, a handgun, inside the apartment, and detectives are investigating to determine who owns it and where it came from, authorities said.

The 4-year-old, who was shot in the back, was taken to a hospital. He is expected to survive, authorities said.

The incident happened just before 4 p.m., when officers were called to a low-rise apartment complex in the 4400 block of 23rd Parkway for a shooting, said Cpl. Mike Rodriguez, a Prince George’s County police spokesman. There, near the complex’s playground, they found the child with a gunshot wound, he said.

Rodriguez did not identify either boy, and he said it is unlikely detectives would seek charges against the shooter. He did say, however, that detectives were trying to determine how the child got the gun, and that the gun owner — or those who should have been supervising the boy — might face criminal charges.

Neighbors said the boys lived in apartment buildings separated by the playground and frequently played together — unsupervised — outside.

“I think it’s sad,” said one neighbor, who spoke on the condition of anonymity to protect her privacy. “Little kids out here playing and one of them gets shot.”

Dee Johnson, 29, who identified himself as the shooter’s uncle, said he was not in the Hillcrest Heights apartment when the shooting happened, but those at the scene told him his nephew found the gun outside. He said his sister, who lives in the apartment with her four children, does not keep guns there.

“I know for a fact my sister don’t keep no guns in the house,” he said.

Johnson, who said he does not live in the apartment and had not yet spoken with his sister or nephew, said his nephew attended Hillcrest Heights Elementary School. He said he was “praying” for the boy who was shot as family members searched for answers about what happened.

“It’s just two little kids, two innocent kids,” Johnson said. “We’re just trying to figure out what’s going on.”