Levi Warnock (33) who was living in Lister Road, East Bowling, Bradford, pleaded guilty to possession of an imitation firearm with intent to cause fear of violence at 8pm on November 4, 2020.
Recorder Ashley Serr said Warnock was waving and pointing the gun and shouting that he was part of the Irish Mafia.
After a woman waiting for a taxi raised the alarm he made racist comments to arresting police officers and threatened them with violence.
His barrister, Rebecca Young, acknowledge that it was frightening in this day and age to come across anyone with a gun.
“No one is able to assume it isn’t real,” she said.
Miss Young said he was “under the influence of an enormous amount of alcohol” as it emerged that Warnock had been drinking up to six litres of cider a day.
While in prison he had been seen by a psychologist and a psychiatrist and he had been sober for months.
Miss Young said his mental health problems, including post-traumatic stress disorder, had played a part in his offending.
She added that it was general rant with the gun rather than being directed at anyone in particular. He told the police he found it and he got rid of it before he was arrested.
Warnock, the father of two young children, wished to apologise as he had gained insight into how dangerous and frightening his behaviour was.
The court heard he had made great strides in custody and he was determined to turn his life around.
He was a wing cleaner in HMP Leeds and had the offer of building work on his release.
The court heard that his 15 previous convictions were mostly committed under the influence of drink.
The court heard that Warnock was in breach of a 16-week suspended sentence order imposed at Coventry Magistrates’ Court for assaulting a police officer and damaging a police car and a police cell.
He pleaded guilty to the Bradford offence at his first appearance at the crown court and was sentenced on a video link after being remanded in custody since April.
Recorder Serr sentenced Warnock to six months’ imprisonment and activated 14 weeks of the suspended sentence consecutively.