A plumber from Los Angeles County who collected thousands of images and online videos of child pornography, including some depicting children under the age of two, was sentenced today to six years behind bars and will remain under federal supervision for the rest of his life.

Richard Celestino of Green Valley, a community on the eastern edge of the Antelope Valley, pleaded guilty in July to possession of child pornography, admitting that he used a peer-to-peer file-sharing network to distribute and possess more than 8,000 illicit images and videos.

Prior to describing some of the “horrific’’ sadomasochistic imagery the 48-year-old defendant collected, U.S. District Judge Percy Anderson warned potentially squeamish audience members to leave the courtroom. Nobody left, but it was clear later on that a few probably wished they had.

During the 90-minute hearing in Los Angeles federal court, Anderson noted that each time child pornography is circulated online, it perpetuates the abuse and re-victimizes those pictured.

“This, unfortunately, is not a unique conviction in this district,’’ the judge said from the bench, adding that Celestino had a “long history’’ of involvement in trading and collecting the illegal material.

Added Assistant U.S. Attorney Kathy Yu: “You don’t just stumble on 8,000 videos and images.’’

Along with the federal prison sentence and lifetime registration as a sex offender, Celestino must pay a $5,000 special assessment pursuant to the Justice for Victims of Trafficking Act, plus restitution, in an amount to be determined, paid to any victims identified in the child pornography.

After Celestino’s attorney unsuccessfully argued for a three-year term, the defendant apologized “to all the victims whose images I watched on those videos.’’

Although not charged with touching any children, Celestino was found to be “deceptive’’ on a polygraph examination when questioned about whether he ever had any “actual contacts’’ with a child, the judge said. Anderson also said Celestino had demonstrated a lack of “impulse control’’ as a result of having viewed child pornography months after the search warrant in the case was executed.