Yesterday at Glasgow Sheriff Court, Alexander Agnew, 53, who admitted sending the politician the emails, escaped a jail sentence.
Sheriff Lindsay Wood ordered Agnew to perform 120 hours of unpaid work.
He also imposed a curfew banning him from leaving his home between 9pm and 6.30am for the next eight months.
Sheriff Wood praised Mr Sarwar, who lost out in the Labour leadership contest to Richard Leonard following the resignation of Kezia Dugdale, before sentencing Agnew
“You had a drink and did things totally unacceptable to a man in the public, who is doing a good job,” he told Agnew.
“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 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.
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.”
The court heard Agnew even created an email address titled “[email protected]” to send some of the vile messages.
The first email, sent on 5 February, 2018, read: “If a cat is born in a stable, does it make it a horse?”
Agnew’s next hate message 10 days later stated: “Not one step back, we are everywhere.”
Mr Sarwar contacted the police after he received further emails of a similar nature.
Police seized the emails and sent them to the Cybercrime Unit. The investigation found the emails all matched up with Agnew’s mobile phone number and his partner’s address.
Miss Adams added: “He said he had no explanation and could not remember sending the emails as he was intoxicated at the time.”