Mr. Gurley died on Nov. 20, 2014, when his heart was pierced by a ricocheting bullet that Mr. Liang had fired while on a night patrol in a dark stairwell in the Louis H. Pink Houses in the East New York neighborhood. In February, a jury convicted him of manslaughter and official misconduct, rejecting his testimony that the gun had simply gone off in his hand and finding that he had failed to help Mr. Gurley as he lay dying on a fifth-floor landing.

Before the sentence was issued, Mr. Gurley’s girlfriend, Melissa Butler, who was with him when he died, told Mr. Liang that even today, she was still in pain and needed the solace of justice. “You took a piece of me,” she said. “You took a piece of my heart.”

Moments later, Mr. Liang himself stood and turned toward Ms. Butler and the others, apologizing for having killed a man they loved. “The shot was accidental,” he said. “My life has forever changed.”

It was at that point that Justice Chun announced that he was going to reduce the manslaughter verdict, saying there was no evidence that Mr. Liang was even aware of Mr. Gurley’s presence in the stairwell. “This was not an intentional act,” the judge said. “This was a criminally negligent act. As such, I find incarceration not necessary.”