A reveller threatened to shoot a bouncer who told him he was barred from entry to a Scots nightclub.
Mohammed Abdullah was stopped from entering The Hive venue in Edinburgh’s Old Town shortly after midnight last Friday.
The 27-year-old lobbed racist abuse at the doorman and said: “I’ve got a gun in the glove box. I’m going to get it and shoot you.”
After cops swooped to arrest Abdullah, he also threatened to “kill” officers and later said he would “burn down” St Leonards police station.
Abdullah appeared at the city’s sheriff court on Monday. He had earlier pled guilty to threatening or abusive behaviour and acting in a racially aggravated manner.
Fiscal depute Ross Price said Abdullah had turned up at The Hive in the city’s Niddry Street after meeting with a pal.
A doorman stopped his entry, the prosecutor said, and told Abdullah that he was barred.
Mr Price told how the accused said, “I’m going to stab you”, before issuing the threat to bouncer Mohammed Salahuddin to shoot him.
The court heard Abdullah then said: “Go back to Africa. Go back to your own country.”
Mr Price said Abdullah was later detained by police on Hanover Street and told them he would “kill them”.
He added: “At St Leonards police station the accused has made various threats, including to kill and to burn down the station.”
Defence agent Victorian Good said her client was suffering problems with his mental health and drinking alcohol made the situation worse.
Ms Good said the threats made by her client were “unpleasant but nonsense”.
Sheriff Nigel Ross told Abdullah, of the city’s New Town area, that his actions were “disgusting” and “absolutely disgraceful”.
He said: “When you start to threaten to stab and kill people, I have to take you off the streets.”
Sheriff Ross said he would call for reports but added he made “no promises” that Abdullah wouldn’t be jailed when he returns for sentencing in March.
Don't miss the latest news from around Scotland and beyond - Sign up to our daily newsletter here.