A teenager was shot and killed Thursday night in Brooklyn, the NYPD said.

The teen was killed sometime before 9:45 p.m. in an apartment on Miller Avenue in East New York.

When officers arrived at the apartment they found the 16-year-old with a gunshot wound to his head.

Emergency responders rushed him to Brookdale Hospital, where he was pronounced dead shortly after 10 p.m.

His identity has been withheld pending family notification.

Police said the teen was playing a Madden NFL video game with with friends inside the apartment when one of his friends waved a gun in celebration after celebrating a touchdown. The gun went off, killing the victim.

The Daily News first reported the details of the apparently accidental killing.

Police have arrested a 15-year-old boy on charges of manslaughter and criminal possession of a weapon.