Former Glee actor Mark Salling has reached a deal with prosecutors to plead guilty to possession of child pornography.

The plea agreement filed in federal court in Los Angeles says the actor admits he possessed images of prepubescent children, Associated Press reported.

Soccer Aid 2014 – ManchesterMark Salling played Noah “Puck” Puckerman in Glee (Martin Rickett/PA)

The agreement says investigators acting under 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 of 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.

The actor played bad-boy Noah “Puck” Puckerman on the Fox musical.