The Wrap reports that he admitted to possessing approximately 25,000 images of children engaged in sexual conduct.

The Glee alum sported a shaved head in court and told the judge that he was on medication for depression, The Blast reports. His sentencing has been pushed back until March, according to the website.

As Us Weekly previously reported, Salling, 35, struck a plea agreement with prosecutors in October that will see him serve four to seven years in court, as opposed to the maximum 20-year sentence the charge carries.

Following his release from prison, he must register as a sex offender and must stay 100 feet away from schoolyards, parks, public swimming pools, playgrounds and video arcades. He also can’t have communication with anyone under the age of 18 unless in the presence of a parent or legal guardian and faces 20 years of supervised release.

The actor has also been ordered to pay approximately $50,000 in restitution to each victim who has requested it, according to court documents obtained by Us, and must enter a sex offender treatment program.

Salling was arrested in December 2015 after the LAPD was tipped off that he had an extensive collection of child porn at his Sunland, California, home. Police were reportedly alerted by Salling’s girlfriend after he showed some of the images to her. He was cut from the film Gods and Secrets following his indictment.