A DUNFERMLINE man has been given one last chance to avoid jail after being caught with a knife and threatening to stab people.

Kieran Smith, 21, had the weapon and said he was going to stab someone during an incident at the James Bank Hostel last year.

Appearing for sentencing at Dunfermline Sheriff Court last Wednesday, Smith, of Barrie Street, had previously admitted that on June 27, he behaved in a threatening and abusive manner whilst in possession of a knife when he shouted, swore and uttered threats of violence.

He also assaulted a police officer by attempting to bite him on the body.

Depute fiscal Dev Kapadia said support workers from the hostel had received a phone call from a resident alleging that someone had been urinating outside the window.

When they went to the person's room, they could see Smith at the window who shouted to them: "I have not pi***d."

They went to speak to him and he picked up a knife and said he was going to stab people. He put the weapon back down when the support workers went to contact the police.

When officers arrived, he became agitated again and told them they weren't going to handcuff him before he tried to bite one officer on the arm as he was being taken towards the police van.

Solicitor Elaine Buist said her client had received threats from other parties within the hostel.

"He was aware he was becoming agitated about that," she said. "The experience in the James Bank Hostel did not seem to be a pleasant one for him. The difficulties he had were exacerbated by the environment there."

Sheriff Charles Macnair placed Smith on a community payback order with supervision for two years and a requirement to do 270 hours of unpaid work within six months.

Before sentencing, he told him: "You uttered threats of violence to members of staff at the James Bank Hostel. They have a difficult job to do and they are entitled to the protection of the court.

"It may be that your threats were not directed at them but whether they were directed at them or not, it is still a serious matter when someone utters a threat to stab while holding a knife.

"It is only with the greatest of hesitation that I am prepared to give you an opportunity and, as far as I am concerned, it is one opportunity and one opportunity only at a non-custodial sentence."