Former Glee actor Mark Salling has died of an apparent suicide weeks before he was due to be sentenced in court over child pornography charges.

Salling, who was 35 when he died on Tuesday, was known for playing bad boy Noah “Puck” Puckerman in the musical comedy series before it ended in 2015.

In December, he pleaded guilty to possession of child pornography after prosecutors said he had more than 50,000 images of child porn on his computer and on a USB drive.

Salling, whose sentencing was scheduled for March 7, was expected to face four to seven years in prison.

Mark Salling
Mark Salling (Richard Shotwell/Invision/AP)

Salling’s body was discovered in a riverbed in the Tujunga neighbourhood of Los Angeles, a law enforcement official who was not authorised to speak publicly has said, according to The Associated Press.

His death is being investigated as a suicide, the official said.

Salling’s lawyer Michael J Proctor said in a statement: “I can confirm that Mark Salling passed away early this morning.

“Mark was a gentle and loving person, a person of great creativity, who was doing his best to atone for some serious mistakes and errors of judgment.

“He is survived by his mother and father, and his brother. The Salling family appreciates the support they have been receiving and asks for their privacy to be respected.”

Salling was first arrested at his Los Angeles home in December 2015 after police and government agents seized a laptop, hard drive and flash drive that contained images and videos depicting child pornography.

Before starring in Glee, he released an album called Smoke Signals, followed by another solo record called Pipe Dreams in 2010.

He shared a Screen Actors Guild award with the Glee cast in 2010 when the show was given an outstanding TV comedy ensemble award.

Salling’s death comes four and a half years after the death of his former Glee co-star Cory Monteith.

Monteith, who played Salling’s on-screen friend Finn Hudson, died from a toxic mix of alcohol and heroin.