A Brooklyn man was charged with accidentally shooting and killing his friend while showing off his gun, police said, as the blizzard whipped outside.

At about 8 p.m. on Saturday, as the snow tumbled down throughout the city, 32-year-old Maciej Gorecki allegedly went to his friend’s Sunset Park apartment to show off his gun, a law enforcement official said.

Gorecki, who thought the gun was unloaded, allegedly held it up to 37-year-old Golabek Zdzislaw’s head and pulled the trigger, a law enforcement official said.

But the gun was in fact loaded and Zdzislaw was found inside the 45th Street apartment and pronounced dead.

Gorecki was charged with manslaughter and second-degree criminal possession of a weapon, police said.

Arraignment information for Gorecki was not immediately available.