Jerrod Don McCabe, 35, was arrested in March after investigators said they found him in possession of pornography depicting children who appeared to be as young as 3.
In court Monday, McCabe entered a guilty plea on three counts of third-degree sexual exploitation of a minor.
He was given a 17-month suspended sentence he won't have to serve if he completes three years of probation.
Investigators with the Cary Police Department Cyber Crimes unit said they learned of McCabe's activity when they noticed a local IP address downloading porn.
"He knew why they were there. He indicated to law enforcement that on occasion he would download child pornography at work, he would masturbate to it, and then he would go and pray for forgiveness and delete the images," explained prosecutor Melanie Shekita.
Shekita said McCabe voluntarily took a polygraph test that indicates he has not molested any children he was around at the church, and no children have come forward alleging abuse.
McCabe's parents, wife, and about 15 member of his church were in court with him Monday.
He was also ordered to receive counseling, register as a sex offender, and stay away from children under 16.