An army cadet major has admitted downloading more than 338,000 pornographic images of children from the internet.
Thomson admitted in court to getting sexual kicks from the images
Suspended Territorial Army officer, Brian Thomson, from Edinburgh, pled guilty at the city's sheriff court to downloading paedophilia between 10 July, 1996 and 4 December, 2002.
The 48-year-old was caught after giving his name and credit card details to a website run by a company in America.
An FBI investigation, known as Operation Ore, came across Thomson's details along with thousands of other people worldwide who had downloaded images from the internet site.
Officers passed Thomson's details to Lothian and Borders Police who raided his flat late last year.
They found 292,473 pictures of youngsters on DVDs, 869 on movie files, 31,177 on the base units, 6849 on CDs, 5,000 images on a computer and a further 1987 images on floppy disks.
About 250,000 of these were of girls from the age of 12 being raped by men and more than 850 were movies of school children.
These images were of children being raped, tortured and otherwise abused
Fiscal at Edinburgh Sheriff Court
Also found were images of Thomson himself with a number of young children at army-style camps.
Fiscal Isabel Clarke said it was the second highest number of images discovered in Britain to date.
"These images were of children being raped, tortured and otherwise
abused," she said.
She added: "This was a deliberate action because he had to give his name and credit card details. He had to pay for each site that he visited."
In court, Thomson admitted getting sexual kicks from the images.
He was remanded in custody and will be placed on the sex offenders' register. Sentencing was deferred for background reports.
Sentencing was deferred for background reports
Sheriff Andrew Lothian told him: "I must emphasise at this stage that every single image represents the abuse of a child and the money you paid helped those responsible for this to arrange the abuse of other children so their business could carry on."
Thomson, of North Gyle Grove, Edinburgh, had worked part-time with the Lothian and Borders Battalion of the Army Cadet Force based in Broxburn since the early 1980s.
However, before his arrest Thomson worked behind a desk rather than directly with the youngsters.
He was suspended from duty immediately after the police investigation began.