Mark Salling, who died this week at the age of 35 after being found hanging, was taking medication for depression and previously tried to take his own life last August, according to reports.

The Glee star, who was due to return to court in March to be sentenced for possession of child sexual abuse images, was last seen on December 17 2017 outside the federal court in downtown LA.

He was joined by his legal team to enter his plea deal, in which - in exchange for a guilty plea - Mark would be handed a jail sentence of between four and seven years.

Mark was seen on October 16 2017 buying soda and cigarettes from his local 7-11 store (Image: VIMU)

Without the plea deal, Salling would have faced 20 years in prison and a further 20 years of supervised release, meaning he could not go within 100ft of schools, parks, public swimming pools and playgrounds, video arcades or any place where children under 18 might frequent.

In addition, he would have been registered as a sex offender and banned from contacting any child, online or verbally, and would have had to submit to a treatment programme.

Mark had been arrested in 2015 and police found more than 50,000 indecent images of children on his computer - some of the victims had been as young as three. It's thought an ex-girlfriend contacted cops with concerns.

The last pictures taken of him were on December 17 2017 (Image: Splash News)

He agreed to make restitution to the victims to the tune of $50,000 for each child who requested it. It's not clear how many victims have come forward.

In his final court appearance, Mark told the judge he was on medication for depression. He wore a navy blue suit over a rumbled white shirt and kept his hands in his pockets as he walked into the courthouse.

Salling kept his eyes shaded with sunglasses and sported a buzzcut. He looked hunched and pale as his legal team escorted him into the building.

It's thought that was the last time Mark was seen in public before his body was found hanging from a tree in Sunland, California, near his home.

Glee star Mark Salling hides his face while ducking down in the passenger seat of a car as he leaves jail after being arrested for possession of child pornography in December 2015 (Image: INF)

A family member had reported him missing at 3am local time on Tuesday and police were called out to do a welfare check on him. They found his body by a creek, near a baseball field, and TMZ reports that he had been there for some time.

A few weeks before his death, Mark had been spotted looking haunted and pale outside his local 7-11 store.

He wore scruffy clothes - a pair of blue jogging bottoms, a crumbled black long-sleeved top and beige sandals - as he made his way out of the shop carrying a carton of cigarettes and a bottle of soda.

Mark looked scruffy and pale in October, having been wearing the same clothes for weeks (Image: VIMU)

He kept his head down as he walked through a car park (Image: VIMU)

Mark had a full beard and kept his head bowed and his eyes down as he walked through the car park.

It's thought he'd been wearing the same clothes for weeks.

His death was confirmed last night by his lawyer, who 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," it finished.

Mixed tributes have been paid to Salling (Image: REX/Shutterstock)

Ed Winter, the assistant chief coroner, told Mail Online that Mark had been pronounced dead at the scene at 9am on Tuesday.

An investigation into his apparent suicide has been opened and a full autopsy will take place within the next two days.

If you have been affected by any of the issues in this article you can freephone the Samaritans on 116123.