He was charged with second-degree murder and did a plea on negligent homicide. It would appear the prosecution were satisfied with his plea?
There are probably more factors underneath - ie any existing rap sheets blah and how convincing the story unfolded in court etc. Who knows what the history of the victim was - he could be totally innocent or a raving pedo. Either way, the defendant has no right to kill him, tho the court obviously believed the defendant never intended to cause death.
But... he's lucky to get off with a very low sentence.
Remember one guy who was convicted for murdering his wife - he ended up serving only 15 ish months (and had to report regularly for a few years after). Apparently the court accepted his wife was a total nag and made his life intolerable

to the point of tipping him over the edge. Again, suppose it's all in the detail and what the court knows of the background in making their assessments.