A steward at Edinburgh Castle was found with 1,200 pornographic images of children on a computer at his home in Peebles.
Gavin McNeish, 58, downloaded them over three years while living in Violet Bank.
The majority – 1,189 – were at the lowest level of grading used by the courts and showed females aged between 10 and 14 either naked or only partially clothed.
But 11 were at higher levels that included either bestiality or sadism, Selkirk Sheriff Court was told this week.
The 58-year-old, now living in Edinburgh, admitted offending between September 2009 and July last year.
Sheriff Kevin Drummond delayed sentencing for reports, but placed McNeish on the Sex Offenders Register for five years.
The police’s child protection unit was alerted to the downloading of child abuse.
McNeish’s lawyer told the sheriff: “He admits he was on the internet far too much viewing pornographic sites and these pop-ups appeared. He stupidly embarked on this further and the images were downloaded. There is no question of distribution to others.
“On the internet he felt it was quite detached, but he now understands that with every image there has been real life abuse.”
The lawyer said McNeish’s 29-year marriage had collapsed and he felt he needed to resign his £1,100 a month job at Edinburgh Castle.