A drunken Rangers fan, who posted a threatening message about Alex Salmond and Nicola Sturgeon on Twitter, after hearing that the then First Minister supported Hearts, has been ordered to perform 140 hours of unpaid work within six months under a Community Payback Order.

Steven Thomson (43), of Lawers Road, Renfrew, pled guilty at Edinburgh Sheriff Court last month to posting a "grossly offensive" message on Twitter on May 4 last year in which he swore, uttered threats of violence and behaved in a threatening and abusive manner likely to cause fear and alarm. The case was continued for background reports.

At the first hearing of the case, Fiscal Depute, Kirsty Anderson, told Sheriff Gordon Liddle, that the message read: "I would gladly set that fat Jambo c..t, Salmond, on fire and his she-male mate, Sturgeon".

The message, she added, had been picked up by others and re-tweeted several times. A member of the public, who received the message on his Facebook site on July 14, 2014, was alarmed and contacted the police.

Investigations led to Thomson, who told the officers: "I know exactly what this is about. It was me. I had had a few".

Defence solicitor, Jamie Bowman, said: "Thomson had no previous convictions. It had been one remark, made in the run-up to the Referendum.

"He had seen something on TV that Alex Salmond supported Heart's Football Club. He had been in a pub and a crude remark about Alex Salmond was well-received and laughed at. He had no intention of harming Alex Salmond. He just dislike d him supporting Hearts".

Mr Bowman described his client's actions as misguided.

He added: "Almost immediately after he sobered up, he realised what a tremendous mistake he had made and described it as the biggest mistake in his life".

In deferring sentence for reports, Sheriff Liddle told Thomson: "The message I have heard you posted is not only threatening, which it is, but disgusting as well. Just because people are prominent public figures does not make them legitimate targets for this sickening abuse".

In court today Michael McKeown, appearing for Bowman, told Sheriff Liddle that the incident had caused his client difficulties with his family and his employers.

He said: "This matter has hung extremely heavily over him. He has become anxious, paranoid and fearful of a custodial sentence and that has had an impact on his health".

Sheriff Liddle told Bowman that the most foolish thing he had done was to post his remarks on Twitter. He told him that although he had deleted the message when he woke up and remembered what he had done, he must have realised that was not going to stop it.

"When one posts such a message, one loses control over it entirely" he said.

He added: "I am aware that those in the public domain are subject from time to time to remarks which might be insulting. I do not see why anyone should have to tolerate that sort of behaviour from anyone".

Bowman was warned that such an action could have resulted in a custodial sentence, but, said Sheriff Liddle: "taking into account the fact you put your hands up to this and pled guilty at the earliest opportunity and your lack of offending history I am satisfied I can impose the alternative of a Community Payback Order".