A Black Watch corporal downloaded indecent images of children on to his phone.
David Kelly, who comes from Fife but was based at Fort George at the time, then shared one of the images on an internet chatroom three times to a fellow member who had asked for it.
Inverness Sheriff Court was told that it was this which led to police searching his room and finding more images on one of two phones and his laptop.
The 37-year-old father of two appeared for sentence yesterday having previously pleaded guilty to downloading the images and then distributing one of them in June last year.
He was ordered to carry out 100 hours of unpaid community work, and placed under social work supervision and on the Sex Offender’s Register for a year.
The sentence may save his Army career, the court heard, but he would still face disciplinary action by his commanding officer.
Defence solicitor Alison Foggo said: “He has never deliberately sought out indecent images of children. He had an interest in adult pornography and had 2,500 legal porn images. But amongst them was a small percentage of illegal images of children.
“He has now stopped soliciting pornography.” Ms Foggo added.