A former New York City police officer avoided prison on Tuesday for the killing of an unarmed black man in an unlit stairwell, two months after a jury found him guilty of manslaughter.

Brooklyn state Supreme Court Justice Danny Chun sentenced Peter Liang to 800 hours of community service and five years of probation, after prosecutors recommended six months of home confinement.

Liang, a rookie who lost his badge after his conviction, had faced a maximum prison sentence of 15 years for the death of Akai Gurley, 28.

The officer was patrolling the darkened stairs inside a public housing building in Brooklyn on Nov. 20, 2014, when he fired a single shot. The bullet ricocheted off a wall and struck Gurley in the chest as he walked one floor below.

Before imposing the sentence, Chun reduced Liang's manslaughter conviction to the lesser felony of criminally negligent homicide, finding that prosecutors had failed to prove Liang "consciously disregarded" the risk of causing another person's death.

RELATED: DA recommends probation for ex-cop Peter Liang convicted in Akai Gurley killing

"There is no evidence, circumstantially or otherwise, that the defendant was aware of Akai Gurley's presence," he said.

The shooting fueled nationwide protests over law enforcement's use of excessive force on minorities. But the Brooklyn case differed from many of the other high-profile incidents that helped intensify the Black Lives Matter movement. The officer, a Chinese-American, was not accused of deliberately killing Gurley.

Meanwhile, Chinese-American activists organized their own protests, claiming Liang was serving as a scapegoat for police misconduct.

Both prosecutors and defense lawyers on Tuesday urged Chun not to hold Liang responsible for the actions of other officers.

"This simply is not a case of police brutality," said Assistant District Attorney Joseph Alexis. "From the beginning until now, this prosecution has always been about justice; it's not about revenge."

Members of Gurley's family have criticized Brooklyn District Attorney Kenneth Thompson for recommending no prison time.

Liang tearfully testified at trial that he did not realize the bullet had hit anyone until he went downstairs and saw Gurley's girlfriend desperately trying to revive him. The officer claimed a noise had startled him, causing his finger to slip onto the trigger and fire.

But prosecutors said he acted recklessly in drawing his weapon and discharging a round.