Mark Salling, who starred on Fox’s hit show “Glee” as Noah “Puck” Puckerman from 2009 to 2015, pleaded guilty to possession of child pornography and faces four to seven years in prison, with 20 years supervised release.

The actor will also pay $50,000 in restitution to each of the victims who request it and register as a sex offender.

Salling was first arrested for possession of child pornography in December 2015 when his residence was searched by the Los Angeles Internet Crimes Against Children Taskforce.

In May 2016, Salling was indicted on two counts of child porn, and charged with receiving and possessing child porn on his laptop and a USB flash drive. The laptop, USB flash drive, and a hard drive seized from his home reportedly contained thousands of images and videos depicting child porn. After the case was referred to federal authorities, he pleaded not guilty in June 2016.

In a plea agreement filed with the U.S. District Court for the Central District of California on Tuesday, Salling, pleaded guilty to “one felony count of possession of child pornography involving a prepubescent minor.” The filing states that more than 50,000 images and videos of child porn and erotica were found on his laptop, in addition to about 4,000 images and 160 videos of child porn found on his USB flash drive.