An East Lothian man has been jailed after he admitted having more than 2,000 indecent images of children.
Richard Leith, 36, from Tranent, had the images on computers at addresses in Greenlaw, in the Borders, between November 2007 and June last year.
A court heard he had been "blanking out" his sadness at the death of his daughter in a car crash at the time.
He was jailed for four months and placed on the sex offenders register for seven years.
Jedburgh Sheriff Court heard the crimes were detected after the suspicions of an apprentice electrician, employed by the accused, led him to check a laptop Leith used for business.
A police search of his computers revealed hundreds of indecent images of children, some of whom were just a few months old.
Sheriff Donald Corke told Leith such images were all part of the process of child abuse, to which he had contributed by his behaviour.
"These were non-contact crimes, but by no means non-victim crimes," he added.
He ordered that Leith should be placed on licence for three years following his release from jail.