An upstate man who urinated on his intoxicated friend — and then left him to die on his grandmother’s front lawn — was sentenced to six months behind bars, according to a new report.

Samuel Heroux, 22, of Cohoes, copped a plea deal with the local district attorney’s office in connection with the 2017 death of 19-year-old Liam McGlinchey — and will serve his sentence in the Saratoga County Jail, the Albany Times-Union reported.

Before handing down his sentence Thursday, Saratoga County Court Judge James Murphy III slammed Heroux for selfishly leaving McGlinchey to die.

“Dumping Liam and urinating on him and filming the urination, seeing foam from dying Liam’s mouth — instead of doing something, you leave,” Murphy told Heroux in court. “A 911 call, a knock on the door, a drop at the hospital, a call for help would have saved his life.”

“The failure to act and care about anyone but yourself, the apathy and disregard for another person’s life is your pattern of behavior,” the judge added.

Heroux’s co-defendant, Isaiah DePiazza, 19, who initially agreed to cooperate with prosecutors, has already been sentenced to one to three years in state prison, according to the report.

Heroux allegedly captured the lewd act on video after he and DePiazza allegedly left McGlinchey on his 91-year-old grandmother’s Clifton Park lawn as their boozy night came to a close.

Both men previously pleaded guilty to criminally negligent homicide, according to the report.

DePiazza initially was expected to be sentenced to probation, but Murphy sentenced him to prison after determining that he violated the terms of his pretrial release agreement, the paper reported.

The charge carries a maximum sentence of four years in state prison, but Heroux will spend his six-month sentence in the local jail, followed by five years of supervision after his release, according to the report.

Before the judge issued his sentence, the court viewed a recorded message by Charlotte McGlinchey, Liam’s sister, who slammed Heroux for his “vile, despicable, thoughtless and heartless actions.”

She said the incident sent shock waves through her family because Heroux and DePiazza dumped her brother “as if he were garbage.”

“I lost my brother and best friend,” Charlotte said in the video. “Every time you inhale, I hope you feel the breaths Liam struggled to take.”

McGlinchey had a blood alcohol content of 0.40 percent, which medical experts say could be high enough to cause death, the paper reported. He was barely able to walk and kept falling when his friends left him on the lawn.

He was born in New York City but spent some time in Ireland, according to the report.