Andrew Melville has been added to the sex offenders' register
A colleague of a head teacher arrested on child porn charges tried to cover up the case by asking a janitor to buy all copies of the local newspaper.
East Lothian Council said the teacher at Whitecraig Primary in Musselburgh, who took the action in March 2008, acted "upon her own initiative".
Former Whitecraig head teacher Andrew Melville, 48, has been ordered to carry out 150 hours of community service.
Police found 457 indecent images of children at his Gullane home.
The court heard that a dozen of the images were at the more serious end of the spectrum.
Mr Melville, who pleaded guilty at an earlier hearing, was also placed on probation for three years.
Sheriff Alistair Noble, sitting in Edinburgh Sheriff Court on Tuesday, said the sentence was appropriate in view of his exemplary service as a teacher, the impact on his family and the fact that a relatively small number of images were involved, and a very small number at the highest levels of pornography.
In my line of work this is a no-no
The sheriff, who spent three minutes looking at images provided by a police officer, told Melville that instead of a relatively short period of custody, a better approach was to place him on probation with special conditions.
These require him to take part in the Community Intervention Group for sex offenders and have his access to a computer monitored.
He was also banned from any contact with children under the age of 16 without approval.
Melville had previously admitted being in possession of and distributing indecent photographs of children between June 2004 and May 2005.
Sentence had been deferred for background reports on Melville, a married man with three teenage children, and to allow the sheriff to look at the pictures.
Lothian and Borders Police were contacted in March last year by colleagues in the West Midlands.
They were told that Melville might have indecent images on a computer.
When they searched his home, officers asked him if there was anything illegal on the computers they found.
He told them: "Just the usual porn, adult porn." Asked if there was anything else, he replied: "Maybe. About four years ago I was given some child images which I deleted. In my line of work this is a no-no."
Melville, who was appointed head teacher at Whitecraig in 2007, was suspended by East Lothian Council when the police investigations began and in July of last year he was sacked, bringing to an end a 22-year long teaching career.
East Lothian Council said that a school janitor was requested to buy all the copies of the local newspaper covering the story in March 2008.
A spokesman said: "I can confirm that a teacher at Whitecraig Primary, acting upon her own initiative and without consulting East Lothian Council, asked the school's janitor to buy up all copies of the East Lothian Courier from shops in Whitecraig when the news about Mr Melville broke in March 2008.
"East Lothian Council does not condone this action and views it as extremely regrettable."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.