Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A father who claimed his 4-year-old son was fatally shot in a home invasion robbery has been charged with involuntary manslaughter after allegedly admitting that he fabricated the story and that the boy shot himself with a gun in their Philadelphia home, police said.

Edward Williams Sr. Philadelphia Police Department

Edward Williams, 28, was arrested Thursday and charged with involuntary murder, two counts of endangering the welfare of a child, corruption of minors and related offenses, according to Philadelphia police.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Police went to the home shortly before 1 a.m. Thursday in response to a 911 call. When they arrived, they were met by Williams, who was on the ground floor holding a toddler, NBC Philadelphia reported. Williams told police the 4-year-old was shot upstairs, the station said.

The 4-year-old was rushed to the hospital, where he was pronounced dead, police said.

Williams originally told police the boy was shot in a home invasion robbery but after hours of questioning, he allegedly admitted that he had lied and that while he slept, the boy shot himself, according to NBC Philadelphia.

"There was a fired cartridge casing still inside the firearm, which would indicate someone who, you know, didn't have like a strong grip on the weapon, so it would be consistent with a child, playing with a firearm," Capt. Jason Smith told the station.

Smith said the boy found a gun in a bedroom closet and shot himself once.

Williams was arraigned Friday morning and is being held on $2 million bail. It is unclear if he has an attorney.

"It's an extremely tragic accident. It really is," Smith said. "But it's certainly one that could have been prevented."