David Leggatt was discovered to have photographed and videoed some of the horrendous catalogue of abuse he perpetrated on two young girls.
Leggatt told police he applied to become a foster carer to help children.
He was asked by detectives if he had been abused as a child but said he had a good childhood and added it was "the internet that corrupted" him, the High Court in Edinburgh heard.
He was found to have amassed 115,700 indecent images of children on computer equipment and 921 video files, including hundreds at the most extreme end of the spectrum.
Leggatt, 59, of Comrie in Fife, admitted sexually abusing and raping one girl beginning when she was aged 11 last year at a house in the county.
He also pled guilty to sexually assaulting another girl from the age of three and attempting to rape her between May 2006 and November 2007.
Leggatt, a former production manager who later became a full-time foster carer, also admitted possessing and making indecent photos of children between August 2010 and August this year. The father of one of Leggatt's victims said after the court proceedings: "It has just been an absolute nightmare."
Advocate depute Gillian Wade told the court that on August 3 this year Fife police received confidential information that someone using the internet connection at Leggatt's address was "heavily involved in the downloading of indecent images of children".
Officers armed with a search warrant arrived and were let in by his wife Heather who called on Leggatt to join them. Both were cautioned but as a detective began reading the warrant Leggatt said: "It's me, it's nothing to do with her. I'm sorry."
He explained his computer and hard drive containing images of children were in the loft. He also went on to confess that he "interfered" with girls.
Mrs Wade said an initial examination of computer equipment found folders with girls names which contained indecent images of youngsters taken by Leggatt. A wide range of child pornography was also found.
One child victim interviewed by police revealed that he would take pictures of her naked and performing sex acts. She was given rewards such as sweets for carrying out sex acts on him.
But she also revealed she was left sore and bleeding after Leggatt's abuse escalated.
The advocate depute said: "The accused would tell her not to tell anyone or he would go to prison and he didn't want to go to prison.
"She was always scared of what he was going to do."
One woman told police that Leggatt's wife said he spent much of his time in the loft on his computer and stated they had not had a sexual relationship for about 10 years.
During an interview with detectives, Leggatt spoke freely and admitted possessing indecent images of children and abusing two youngsters.
Mrs Wade said: "He said he had looked at adult pornography on the internet and had accidentally clicked on indecent images of children.
"The accused went on to say that he had an interest in little girls, prepubescent age."
The judge, Lord Bracadale, said he required to obtain a background report on first offender Leggatt, who was remanded in custody, before passing sentence on him.
Defence solicitor advocate Gordon Martin will address the court in mitigation next month.
Lord Bracadale continued the case to the High Court in Glasgow on December 19 and placed Leggatt on the sex offenders register.