WOODBURY, N.J. (CBSNewYork/AP) — A judge has sentenced a former southern New Jersey policeman to 30 years in prison for the shooting death of a friend.

James Stuart was convicted last October of murder and aggravated manslaughter in the January 2013 death of David Compton.

READ MORE: NYPD Officer Jason Rivera Fatally Shot, Officer Wilbert Mora Critically Injured Responding To Harlem Domestic Dispute

Stuart, 31, shot his friend David Compton, 27, in the face at Stuart’s Deptford home while he was off-duty, prosecutors said.

Stuart testified Compton, of Woodbury, went to his home after they were at a bar and Compton asked to look at his off-duty weapon while they were watching the movie. Stuart said he unloaded the Glock 27 and let Compton dry-fire it at the “bad guys” on the screen in the film.

Later, Stuart fell asleep, then he awoke and picked up the gun from a sofa to dry-fire it at the TV but turned as Compton spoke, heard a loud boom and saw a small hole in Compton’s cheek, prosecutors said.

READ MORE: 'The Loss Of A Hero': New York Mourns Death Of 22-Year-Old NYPD Officer Jason Rivera

Compton died six days after the January 2013 shooting from brain damage due to oxygen deprivation, prosecutors said.

Stuart’s blood-alcohol content tested at 0.14 percent, above the state’s limit of 0.08 for alcohol-related offenses.

Prosecutors said Stuart acted recklessly. Stuart said he didn’t know the gun was loaded and he would never have hurt Compton.

The 32-year-old must serve 30 years before he’ll be eligible for release.

MORE NEWS: With Tragic Shooting Of 2 Police Officers In Harlem, 5 NYPD Officers Have Been Shot In January

(TM and © Copyright 2016 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2016 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press contributed to this report.)