A soldier downloaded a stash of child abuse images at his army base and then threatened to kill police officers who seized his computer equipment.
Fraser Waddell, who served as a private in the Royal Scots Dragoon Guards, was arrested after police swooped on his room at the Leuchars Station base in north-east Fife.
The 21-year-old last year avoided a jail term over a bizarre incident in which he pulled over two women on a motorway at 2.30am and pretended to be a police officer wearing body armour and a peaked cap.
Officers who came to speak to him in relation to another incident found 21 indecent images of children on his mobile phone.
Dundee Sheriff Court was told some were at the top end of the scale used to measure such pictures.
A month after the raid Waddell phoned Police Scotland Tayside Division’s Dundee HQ threatening to seek out a specific officer and to kill him and others.
Depute fiscal Sue Ruta told the court: “He was asked to provide the PIN for his phone but said it wasn’t his.
“It was found to belong to his ex-partner who said she had given it to him.
“Upon examination it was found to contain 21 indecent images of children in the cache of the Google Chrome browser.
“Search terms indicated he had actively sought them out.”
Waddell of Macmillan Street, Larkhall, pleaded guilty on indictment to a charge of taking or making indecent images of children on May 24 last year.
He was on two separate bail orders at the time.
His not guilty plea to possessing extreme porn images was accepted by prosecutors.
Sheriff George Way deferred sentence until November 9 for social work background reports and released Waddell on bail meantime.
In January 2017 Waddell was sentenced to 120 hours of unpaid work and a year’s supervision over his threats against police.
And last March – just weeks before his child abuse images arrest – Waddell was fined £1,000 over his fake policeman stunt.