DETROIT (AP) — A Detroit man has pleaded guilty to a misdemeanor in the accidental fatal shooting of his 18-year-old friend that was livestreamed on social media.

The Wayne County prosecutor's office says 18-year-old Dawone Cook entered his plea Wednesday to a charge of careless discharge of a firearm causing death.

Prosecutors have said the men were posting live video on Instagram on April 2 when Cook shot Dylan Hemphill in the head with a rifle in a northwest Detroit home. Police have said the two were showing off weapons and money in the video.