A man pointed a firearm at police officers during a stand-off in Motherwell.
Alan McKenzie pulled the trigger but the weapon, which turned out to be an airgun, was firing blanks.
McKenzie (24) appeared at Hamilton Sheriff Court following the incident in a common close near his home in Watson Street, on March 30.
He admitted causing police officers to believe that unlawful violence would be used against them.
He also admitted slamming a window which caused shattered glass to fall on officers 40 feet below.
Luckily, no one was injure as the jagged pieces hit the ground with force.
Vish Kathuria, prosecuting, said “numerous” officers attended around midnight after a report about a suicidal male.
They were then confronted by McKenzie.
His next move saw him pointing the gun at them and threatened to shoot himself.
He also brandished broken glass and challenged the officers to fight.
After repeated requests from specialist officers to cease and desist, McKenzie eventually agreed to drop the gun.
He was taken to hospital to have superficial cuts checked over.
However the matter did not end there.
McKenzie also admitted threatening police and resisting arrest at the same location while on bail two weeks later.
Lawyer Diarmid Bruce said his client had been suffering from depression, exacerbated by drinking.
Mr Bruce added: “It was bizarre behaviour.
“However, he has a history of poor mental health. He’s vulnerable.”
Sheriff Thomas Millar told McKenzie: “This was a serious incident. However, I’ll step back from imposing a custodial sentence.”
McKenzie will be supervised for two years.
He must attend addiction and mental health counselling if told to.
He must also carry out 300 hours of unpaid community work within a year.