LABOUR MSP Anas Sarwar feared for his safety and that of his family after receiving abusive racist emails, a court was told.

Today at Glasgow Sheriff Court, Alexander Agnew, 53, who admitted sending the politician the vile emails, escaped a jail sentence.

Sheriff Lindsay Wood ordered Agnew to perform 120 hours unpaid work.

He also imposed a curfew banning him from leaving his home between 9pm and 6.30am for the next eight months.

READ MORE: Humza Yousaf hints at ground closures as he urges Scottish football chiefs to tackle sectarianism

Sheriff Wood praised Mr Sarwar, who lost out in the Labour leadership contest to Richard Leonard following the resignation of Kazia Dugdale, before sentencing Agnew.

He told Agnew: "You had a drink and did things totally unacceptable to a man in the public, who is doing a good job.

“You had no business doing that and it was embarrassing some of the stuff you were putting out - you tried to be clever and it was anything but."

And the sheriff warned Agnew: “If you breach this order you will face me again.”

Agnew sent eight emails in February last year which included sick videos from a right-wing terrorist group Nation Action.

One told Mr Sarwar that he was “no longer welcome” and another warned that his office would be torched.

READ MORE: Glasgow rocket science student convicted of repeatedly raping woman after night out

Earlier this month, prosecutor Lucy Adams told the court that the emails had an impact on the life of Mr Sarwar.

She said: “Mr Sarwar perceived the content of the emails to be racist and sinister.

“He felt anxious and personally threatened as a result of receiving them, particularly after viewing the video.

“He feared for his safety and for that of his family, believing he had been targeted because of his race and his campaign against racial hatred.”

Lawyer Campbell Porter, defending, said: "Mr Agnew has a drink problem and he apologises for his behaviour."

Mr Sarwar said after the sentencing: “Since launching the campaign against everyday Islamophobia and racism, I have been repeatedly subjected to threats and racist abuse.

“While it has been a very difficult time for me and my family, it has strengthened my resolve to keep fighting for those who aren’t as fortunate as I am to have a voice.

For all your breaking Glasgow news, click here, or head to our Facebook, Twitter and Instagram pages

“I want to thank the police and courts for their action in this case and hope it encourages victims across Scotland to report instances of anti-Muslim hatred.

“I am pleased to have launched the first-ever pubic inquiry into Islamophobia in Scotland, and this case demonstrates why it is important to understand both the scale of the challenge and the work needed to find solutions.

“I would like to thank my friends and family, politicians from all parties, and the media for their support, and I remain increasingly confident that by working together we can build a Scotland that is free of prejudice and hate.”