A man who admitted a string of sex offences against children, including raping a young girl and attempting to rape another, claimed "the internet corrupted him".

David Leggatt pleaded guilty to raping the girl on various occasions and taking photos of the abuse. The 59-year-old also admitted sexually assaulting another girl and attempting to rape her.

Leggatt, of Dunfermline, Fife, was found to have almost 120,000 indecent photos and videos of children when his computer was seized by police.

At the High Court in Edinburgh today, he admitted all the offences which occurred between May 2006 and July this year.

Advocate depute Gillian Wade, prosecuting, told the court that police went to Leggatt's home on August 3 after receiving confidential information that someone was "heavily involved" in downloading indecent images of children.

Officers from Fife Constabulary were granted a search warrant and Leggatt took them upstairs and showed them his computer equipment.

He explained his computer and hard drive in the loft contained images of children. He also confessed to them that he "interfered" with girls.

Ms Wade told the court the equipment contained "vast quantities" of indecent photos and movies of children. Some of the files had girls' names which had images that Leggatt had taken himself.

The court heard how one of the girls told police during an interview that Leggatt would promise her whatever she wanted in return for sex acts.

The advocate depute said: "All through this, 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 added: "She was always scared of what he was going to do."

Leggatt also told police he had photographed another girl sitting naked from the waist down but had not touched her sexually in any way.

The court heard that when Leggatt was interviewed by police he claimed it was "the internet that corrupted him".

He admitted the charge of raping the girl and attempting to rape the other while also pleading guilty to possessing 115,700 indecent images and 921 video files of children.

Judge Lord Bracadale placed Leggatt on the sex offenders' register and told him he will be sentenced next month.