A violent criminal warned police that he had a pipe bomb in his bedroom and would detonate it if they tried to detain him.
Arran Adey told officers they should evacuate his block of flats in Lochgelly before he set off the bomb.
Adey, 29, of Buller Street, admitted that on Tuesday he behaved in a threatening or abusive manner by threatening police officers, saying that he would light a pipe bomb if they tried to detain him and advised officers to evacuate the block of flats as the pipe bomb would be detonated.
In January 2013, Adey had been given a 45-month jail term for subjecting a young woman to a terrifying ordeal in her Edinburgh home.
He and another man broke into her flat, threatened her with a screwdriver, tied her to a chair and robbed her, leaving the 20-year-old victim traumatised.
They had been spying on her before breaking in.
Adey was released from jail early in December 2014.
Depute fiscal Kyrsten Buist told Dunfermline Sheriff Court that at around 7.30am on Tuesday police were made aware of an ongoing disturbance.
They had intelligence that the accused was involved.
When officers went to the house they were allowed in by Adey’s partner.
She let them look around the flat apart from a bedroom. She stood in front of the door, saying a four-year-old child was sleeping in there.
“Police were firmly of the view that the accused was within the bedroom,” said Ms Buist.
The woman continued to refuse entry to the room and a search warrant was sought and quickly obtained.
However, police then heard a male voice from the bedroom warning: “I have a pipe bomb in here.”
The police engaged him in conversation and the man reiterated that he had a pipe bomb in his possession and he would light it if officers came through the door.
“The accused said they should evacuate the block of flats due to the size of the bomb,” Ms Buist said.
The conversation was continued and Adey eventually admitted he did not have a pipe bomb and was detained.
The accused’s partner was also arrested, said the depute.
The court heard that Adey had been released early from a 45-month High Court sentence imposed in December 2014 and still had an unexpired portion from that term.
In these circumstances, Sheriff Charles MacNair referred the case to the High Court for its consideration.