FILE - In this March 13, 2015 file photo, Mark Salling arrives at the 32nd annual Paleyfest "Glee" held at The Dolby Theatre in Los Angeles. Prosecutors filed
a plea agreement on Tuesday, Oct. 3, 2017, in which Salling agrees to plead guilty to possession of child pornography in a case filed after investigators found more than 50,000 images of child porn on his laptop in December 2015. (Photo by Richard Shotwell/Invision/AP, File)

LOS ANGELES (AP) — Former “Glee” actor Mark Salling has reached a deal with prosecutors to plead guilty to possession of child pornography.

The plea agreement filed Tuesday in federal court in Los Angeles states the actor is admitting he possessed images of prepubescent children. The agreement states a search warrant found more than 50,000 images of child porn on Salling’s computer and a thumb drive.

Prosecutors and Salling have agreed to ask a judge to sentence the actor to a prison term between four to seven years. He will also be required to register as a sex offender, pay restitution and abide by restrictions on where he can live.