Vincent Copeland from Leigh-on-Sea, Essex, who admitted three counts of making indecent images, must join a sex offenders' treatment programme.
He confessed to the offences in a letter to friends found at his home, Ipswich Crown Court court heard.
Judge David Goodin said Copeland had been "completely humiliated".
The 61-year-old was arrested after officials in the US contacted the UK authorities about his online activity, and police went to his home in Leigh Road.
The charges related to seven images. Three were in the most serious category - A - and involved boys as young as 10. Two were category B and a further two category C.
In the letter found at his home he said he was ashamed and he would serve his sentence.
An earlier hearing revealed Copeland often talked online with other adult males as well as posing as a child having fantasy chats online, but he had never touched a child.
Judge David Goodin said: "As a teacher and a magistrate he should have known better... it's complete humiliation."
He gave him credit for his early guilty plea and for the fact he had previously referred himself to a self-funded Lucy Faithfull foundation treatment programme.
He told him: "You could never have imagined yourself in this position."
He said the three-year community order had two conditions - that he take part in a 30-day rehabilitation activity programme and in an internet sex offenders' treatment programme.
A former magistrate and retired deputy head who made images of child sexual abuse has been given a three-year community order.