Three youths received a shock when they abused a stranger who then pulled a gun out of the boot of his car and threatened them.
Dunfermline Sheriff Court heard that being faced by the masked gunman must have been a “terrifying” experience for the youths who were unaware the gun was an imitation.
Kenneth McLean, 27, of Braehead Road, Kirkcaldy, admitted that on October 27 2014 at Whirlbut Street, Dunfermline, he behaved in a threatening or abusive manner and with his face masked, he shouted, swore, uttered threats and brandished an imitation firearm.
Defence solicitor Sarah Meehan said her client had been wearing a hooded top and pulled the toggles tight so that only his eyes were visible.
She said the BB gun had previously been found on the ground by his partner and McLean had put it in the boot of his car out of the way.
A diabetic, McLean had gone to the car boot where equipment was kept for checking his blood sugar level.
Ms Meehan said: “When he reached the boot of the car he happened upon three young males, one on a moped and two on bicycles. They began shouting and swearing at him and also throwing pebbles at him.”
McLean accepted he had acted in a “foolish” and “extremely stupid” way, added the solicitor.
Sheriff Charles Macnair said, “These boys whatever they have done would not have known that what was being pointed at them was a BB gun and not a real one.
“It must have been a terrifying experience.”
McLean was ordered to carry out 270 hours of unpaid work and was given a seven-month restriction of liberty order.