A teenager who robbed a Glenrothes shop at knifepoint had initially tried to buy a bottle of vodka with fake ID.
The boy made off from the Premier store, in the town’s Kenilworth Drive, with the booze.
At Kirkcaldy Sheriff Court he narrowly escaped a jail sentence.
CCTV of the offence was played in court, which showed the shopkeeper stagger back in shock as he was confronted with the blade the teenager had pulled from the waistband of his trousers.
The teenager was then handed a bottle of vodka before bolting through the door and across the car park.
Sentence had previously been deferred for social work reports.
Solicitor David Bell said the teenager, who had just turned 16 at the time of the offence and is still too young to be named, had “got himself into trouble”.
He said: “He was only 16, he was extremely immature and didn’t think through what he was doing when he had been drinking.
“He’s had a wake up call while working with social workers.
“He went into the shop to purchase alcohol.
“He produced inappropriate, or fake, ID for that and was refused service.
“The knife was presented after the shopkeeper told him to get out.
“It does not seem that his initial intention was to rob the shop.
“It was a particularly serious incident and he utterly regrets his actions.”
Mr Bell added: “He has really pulled himself up by his bootstraps since this incident.”
Saying he considered “custody is not essential” in the case, Sheriff Ian Anderson ordered the teenager to carry out 180 hours of unpaid work and placed him on an 18-month supervision order.
The boy had previously admitted assaulting shopkeeper Haroon Muhammed during the course of his employment by presenting a knife and robbing him of a bottle of vodka on January 30 last year.
The court heard that the boy and an acquaintance entered the shop at around 1.30pm and they purchased cigarettes and alcohol with his hood up before leaving.
Three hours later, the boy, who is from Fife, returned to the shop with a companion.
Suspicious, the shopkeeper asked for ID and when the proffered card was refused he became aggressive.
When the shopkeeper told him to leave and tried to usher him from the shop, the teenager produced a large knife.
Returning to behind the counter, the employee placed a bottle on the counter as another customer entered the shop.
As the accused ran away, Mr Muhammed threw a second bottle at him, which did not strike the teenager but smashed.
Police traced the boy half an hour later at a bus stop.