A man threatened to jump off the roof of his Kirkcaldy home during a four-hour stand-off with police.
At the height of the incident police negotiators were called in to try to talk Kieran Nelson into surrendering.
Kirkcaldy Sheriff Court heard the 21-year-old was high on a cocktail of Valium and alcohol at the time.
Officers were first called to his property, in Kirkcaldy’s Church Street, after he posted a distressing live video of himself on social media.
Dog units and negotiators
Fiscal depute Lee-Anne Hannan told the court: “At around 9.20pm Police Scotland received three calls in quick succession about a noise of smashing glass and a Facebook Live in which the accused appeared to be self harming.
“Several officers went to the locus and the accused was shouting and swearing.”
She said dog units, an ambulance and the fire service were all summoned.
“A police sergeant, negotiators and public order officers also attended.
“Officers attended at the address of his ex-partner and she had made the initial call.”
Fears were raised for Nelson’s mental health and safety.
Meanwhile, at the Church Street address officers had removed the door of the property to get a view of the accused.
Ms Hannan said: “The accused left the property by exiting the skylight, before returning and playing loud music.
“The accused then concerned police by threatening to jump from the roof.”
At this point officers entered the property and detained Nelson.
50 Valium and alcohol
Ms Hannan said the entire incident had lasted four hours and Nelson was under the influence of 50 Valium tablets and alcohol.
Nelson’s solicitor confirmed he had taken the cocktail of drink and drugs.
He added Nelson was aware the incident was serious and apologised for his actions.
Nelson, a prisoner at Glenochil, admitted behaving in a threatening and abusive manner on March 4 and 5 by live streaming the video, shouting, swearing, barricading the property, threatening to harm police officers and climbing on the roof of the property.
Sheriff Keith O’Mahoney sentenced Nelson to 12 months in prison.