Former NYPD Officer Peter Liang was sentenced to probation on Tuesday by a Brooklyn judge for shooting an unarmed black man in a public housing stairwell in 2014 in a ruling expected to set off denunciations from police critics.

Brooklyn Supreme Court Justice Danny Chun also set aside the verdict of manslaughter and reduced the charge to criminally negligent homicide.

In addition to 5 years’ probation, Chun ordered 800 hours of community service. He imposed a concurrent probation sentence for official misconduct.

“This was a negligent act,” the judge said. “Given the defendant’s background and how remorseful he is, it is not necessary to incarcerate him.”

The ruling followed a plea for leniency from Liang, who apologized to Gurley’s family. “My life is forever changed,” he said. “I hope you give me a chance to rebuild it.”

But Gurley’s family and supporters began to cry inside the courtroom. “Black lives don’t matter,” one shouted as she passed reporters.

The no-jail sentence had been expected ever since Brooklyn District Attorney Kenneth Thompson called for probation last month, arguing that Liang, 28, was reckless but didn’t intend to kill victim Akai Gurley.

The fatal shooting of Gurley has fueled protests over police use of force against minorities, but after Liang’s February conviction it also became an emotional rallying point for Asian-American supporters who said he was being scapegoated.

Liang and another officer were conducting a so-called “vertical patrol” at the Louis Pink Houses in East New York at the time of the incident on Nov. 20, 2014. In tearful testimony at his trial, Liang said he had unholstered his gun and fired by accident when he was startled by a sound.

The bullet ricocheted off a wall and hit Gurley, 28, who had just entered the stairwell with his girlfriend one floor below Liang. When Liang found Gurley bleeding to death, he did not perform CPR — he said his training was inadequate — and instead tried to call for help.

Although he claimed the bullet was an accident and was convicted of acting recklessly, prosecutors argued in closing arguments that Liang in fact fired on purpose in the direction of the sound he heard, which was Gurley.

Chun could have imposed a maximum sentence of 5 to 15 years in prison for manslaughter. Liang and the prosecution are both appealing the case.

Outside the courthouse, protesters gathered in support of Liang and Gurley’s family.

Kim Ballinger, the mother of Gurley’s 3-year-old daughter, said she was not prepared for the reduced verdict. “I believe that the jury’s decision was correct,” she said, calmly. “I was not prepared for a reduced verdict.”

Scott Rynecki, the lawyer handing the civil suit for the Gurley family, said now that the sentencing is complete, “we will push forward with our lawsuit.” He said there is no dollar figure attached to suit. But he said the family is angry at the reduced charge. “It was a shock,” he said.

Hertencia Petersen, Gurley's aunt, called Liang “a murderer.”

Bronx resident Dejohn Jones, 40, said the former officer should serve his community service in Gurley’s community.

“I think his community service hours should consist of rebuilding the community,” she said.

Asked whether Liang should have gotten prison time, New York City Mayor Bill de Blasio said through a spokesman: “The death of Akai Gurley was a tragedy. We respect the judge’s decision in this case, and we ask New Yorkers to continue our city’s tradition of expressing their views peacefully.”