The 28-year-old launched a racist tirade when he entered the site in the south side of Glasgow and told followers at the mosque that he had a bomb inside his backpack and they should run away. Rae, of Johnstone in Renfrewshire, also shouted that he had a gun and threatened to shoot those near him.
Police arrested Rae at the scene before officers searched his backpack and found a “Scream” mask, gloves and scissors, while he continued to shout racist and threatening remarks.
At Glasgow Sheriff Court on Thursday, Johnstone was jailed for two years and four months after pleading guilty to threatening and abusive behaviour and possessing a knife.
John Dunn, Procurator Fiscal for West of Scotland, said: “Everyone has the right to live free from violence, threats, intimidation or the fear of harassment or abuse stemming from the prejudice of another person. To be targeted because of the colour of skin or faith is totally unacceptable.
“Hopefully the conviction and sentencing of Fraser Rae will encourage the public to report all hate crimes to the police. They can have the confidence that all such crimes will be investigated carefully and prosecuted robustly.”