A KILMARNOCK man was told he avoided jail "by the skin of his teeth" after being found in possession of a knife in two of the town's busiest areas.
Andrew Cunningham, 21, of Erskine Place, pleaded guilty to one charge in relation to the incident when he appeared at the town's sheriff court last month.
He admitted being in possession of a lock knife in Bank Street, the Burns Mall and Kilmarnock bus station on August 25 last year.
The procurator fiscal said Cunningham was spotted by a security guard entering the bus station at around 6.30pm and showing the knife to two boys before putting it back in his pocket.
Cunningham then went over to another group of youths and showed them the blade before leaving in the direction of the Burns Mall.
There he approached another security guard and again showed them the knife.
The guard asked Cunningham to hand over the weapon, but he refused and instead showed it to another person before going back to the bus station.
Security guards called police, but before officers could find him, Cunningham was seen on CCTV with another group of youths before making his way back to the Burns Mall via King Street.
On seeing police at the shopping centre he made his way elsewhere.
Police eventually traced him on later that day on Bank Street, where he told officers he had had the knife but had thrown it away.
Cunningham was arrested and charged and the knife was later recovered.
His lawyer told the court: "He is still a young man and has had a traumatic childhood. He struggled to cope and resorted to alcohol as his main vice.
"He has sought to deal with his addiction issues and spent a period in a Young Offenders Institute, which is not something he wishes to experience again.
"He accepts any community order imposed would be at the highest level, because he accepts that he was drunk with a knife."
Sheriff Murdoch Mactaggart told Cunningham that he was only narrowly avoiding spending more time behind bars.
The sheriff said: "You are avoiding custody by the skin of your teeth. If you breach the order you will come back here and custody would be at the forefront of my mind."
Cunningham was sentenced to 160 hours of unpaid work, and will be under curfew from 7pm until 7am for the next six months.
He will also be supervised by social workers for 12 months, and will be required to undertake alcohol treatment as directed by his supervisor.
Read the rules here