Former “Glee” star Mark Salling pled guilty to possession of child pornography involving prepubescent minors on Tuesday. He will serve between four and seven years in prison.

As part of the plea, the actor will have to register as a sex offender, enter a treatment program, have no unsupervised contact with anyone under the age of 18 and stay away from schoolyards, parks, swimming pools, playgrounds and video arcades, according to court documents obtained by The Blast.

Salling, 35, was also ordered to pay $50,000 in restitution to each victim of the child pornography who has requested it.

The documents reveal that Smalling knowingly downloaded thousands of images of child pornography between April and December 2015, hiding the activity with software that masked his IP address. He was eventually caught after he showed the images to a woman he was in a relationship with, who reported the actor to authorities.

Salling was arrested on Dec. 29, 2015, after a search of his Los Angeles-area home three days prior turned up thousands of files of child pornography on his laptop, a thumbnail drive and an encrypted hard drive.

The actor, who faced up to 20 years behind bars, will have to submit to 20 years supervised release once his prison term is up.

i guess he thought the woman he was dating would be down with child porn? just mind blowing. does this mean he will actually serve 4-7 or be out in 2. Doubt this guy can rehabilitate. No wonder he played a punk on Glee. i liked him anyway. but this is disgusting.

Mark Salling made good on his plea deal by marching into court Monday and pleading guilty to possession of child pornography involving a prepubescent minor.

Salling was in the L.A. courthouse and, as we expected since he struck the deal in October, pled guilty. Prosecutors say more than 50,000 images of child porn and child erotica were found in the ex-"Glee" star's possession. The victims were ages 3 to 5.

Prosecutors recommended he get 4 to 7 years in prison under the plea deal ﻿-- as opposed to the 20 years he was facing under a max sentence. The judge will sentence him in March.

For now, Salling is out on bail. As we reported, he cut his wrists in an apparent suicide attempt earlier this year. His attorney denied Mark was trying to kill himself.

I want to vomit. I also wonder what the sentence would have been for a black man. If rapist Brock Turner had been Jose Rodriguez, or Mohammed Ibriz, would they not only be walking around free today, but trying to get the sentence overturned?

The hard truth is that children, women and people of color are treated as disposable in Trump's America. He didn't create this vile attitude and behavior, but he normalized it, applauded it in fact. It is so disheartening, but we can't give up. At least, that's what I try to tell myself.

Not that I'm giving him a pass, but you know who I want to see punished? The disgusting, vile criminals who took the pictures/video. It's bad enough that someone gets pleasure watching this stuff, but to create it? I just can't even.