SUDBURY -- Michael Marois has pleaded guilty to second-degree murder in a court hearing via video conference Friday morning.

The 51-year-old Greater Sudbury man was originally charged with first-degree murder in the death of Michael Young, 51, following a shooting in the Rita Street area of Hanmer the evening of July 12, 2020.

Marois attended a social gathering at a residence with a semi-automatic handgun and fired five rounds of ammunition, the judge heard. He also had a loaded shotgun with him.

An agreed statement of facts in the case said the accused was upset about flirtatious messages he had read on Facebook from a woman to the victim. The lawyer for the accused, Robert Beckett, told CTV News the woman involved in the Facebook messages was Marois' estranged spouse.

When Marois saw two of them attending the gathering, he claims he just "snapped."

Young died of his injuries from a single gunshot wound that punctured vital organs while being transported to hospital.

Marois was also transported to hospital after slitting his neck with a knife.

The accused has been in custody at the Sudbury jail since his arrest the evening of the shooting.

A sentencing date has been set for May 25 when the judge will hear victim impact statements.