A 75-year-old man, caught in a police internet sting when he tried to meet a child for sex, has walked free after a judge decided not to send him straight to prison.

Police set up the sting by specialist officers pretending to be a 14-year-old boy online.

Alan Wright, a leading figure in the Freemasons, was arrested after he arranged to meet the teenager at Bury St Edmunds railway station in November last year, Ipswich Crown Court heard.

Wright resigned from his Grand Master masons role in December last year before his paedophile offence hit media headlines.

Richard Kelly, prosecuting, said that Wright sent the “boy” pictures of his private parts over the internet and arranged to meet him through the dating app Grindr.

However, when Wright, who had brought condoms with him, arrived at Bury station he was met by police officers and arrested.

Wright, of Rye Gardens, Little Downham, Ely, admitted attempting to incite a child to engage in sexual activity and was given a 16 month prison sentence suspended for two years.

He was also ordered to take part in the Thames Valley Sex Offenders’ Treatment Programme and a 40-day rehabilitation activity requirement.

He was further ordered to do 80 hours unpaid work in the community and was made the subject of a sexual harm prevention order and ordered to sign the sex offenders’ register for ten years.

Wright was ordered to pay £1,200 costs and a £140 victim surcharge.

Wright was former Grand Master of the Grand Council of Royal and Select Masters and also Grand Master of the Provincial Grand Lodge of Mark Master Masons of Essex.

He resigned irrevocably from Freemasonry with effect from December 1, 2016.

Sentencing him Judge Martyn Levett said Wright had no previous convictions and while a prison sentence would deal with reducing the short term risk he posed the TVSOTP would aim to reduce the risk of him reoffending in the future.

Judge Levett said Wright had genuinely believed the person he was communicating with and was arranging to meet was a real boy and had made sexual references during their exchanges. “There was a significant difference in your ages,” said the judge.

Judge Levett said Wright had asked the “boy” if one of his friends wanted to “join in” and he said he didn’t accept that Wright wasn’t sexually attracted to children.

He warned Wright he would go to prison if he breached the suspended sentence order.

• An NSPCC spokesperson said: “Wright knew his depraved actions were wrong but still set about grooming and meeting a boy he thought was just 14.

“It is right that he has been given treatment as part of his sentence, which we hope will ensure he is not a risk to children in the future.

“The NSPCC has campaigned to make it illegal for an adult to send a sexual message to a child and – from today - police now have the power stop groomers sooner.

“Anyone concerned about a child can call the NSPCC’s helpline on 0808 800 500. Children can contact Childline anytime on 0800 1111.”