Former Glee actor Mark Salling is facing up to seven years in prison after pleading guilty to possessing child pornography.

The 35-year-old lowered a potential 20 years in jail by accepting a plea deal offered by federal prosectors earlier this week, and must register as a sex offender and avoid places which children attend when released.

Catch up on all of the celebrity news happening right now >>>

“I am pleading guilty because I am guilty of the charges and wish to take advantage of the promises set forth in this agreement, and not for any other reason,” Salling said in a statement, according to court documents.

Mark, who was known for playing jock Puck in the hit TV show, was arrested back in December 2015 after a tip from one of his former girlfriends led police to find thousands of images and videos of child pornography on his laptop and separate drives.

Mark will also be required to pay $50,000 to each victim as well as having to enter treatment for sex offenders upon his release from prison.

While it was also previously reported that he was once sued by a former partner for sexual battery, with Roxanne Gorilla claiming that the actor forced her to have unprotected sex with him. This was settled out of court for a reported $2.7million.