As Akai Gurley left his girlfriend’s apartment in a Brooklyn housing project one November night two years ago, he tried to take an elevator to the street, but found that it was broken. Had it been working, Mr. Gurley might never have set foot into the stairwell where he died.

It was the kind of freakish detail that pervaded the case of his killer, the former New York City police officer Peter Liang. Not only was the elevator broken, but the lights in the stairwell were out. And Mr. Liang was a rookie, not even a year out of the Police Academy. Moreover, the shot he fired glanced off a wall, caromed randomly and struck Mr. Gurley in the heart.

The accidental nature of the killing was noted by many on Tuesday when Mr. Liang was sentenced to probation in State Supreme Court in Brooklyn, avoiding a prison term in one of the most divisive police misconduct cases in recent city history. Paul Shechtman, a lawyer for Mr. Liang, argued in court that there had never been a manslaughter case in New York in which the allegations were less egregious and the conduct less blameworthy. Ruling that the shooting had been unintentional, Justice Danny K. Chun, who presided over the case, went so far as to reduce the jury’s verdict from manslaughter — based on recklessness — to the less severe criminally negligent homicide.