As PCs Gregg Armstrong and Victoria Thomson approached James Pickthall in the town’s St Andrew’s Street he was carrying a knife pointed towards them.
And Dumfries Sheriff Court was told that the officers warned him to get down on the ground but he refused and then ran off and was seen throwing the knife away.
Fiscal depute Pamela Rhodes said: “The sound of the knife hitting the ground was clearly heard as police gave chase and caught up with him nearby where he was warned he would be sprayed if he didn’t lie down.”
In the court on Tuesday, Pickthall, 36, who had been staying in Castle Douglas at the time and had been in custody since the incident at the end of January, admitted assaulting the two officers by brandishing a knife at them.
He also admitted running away from them and throwing away the knife which had been in his possession, refusing to comply with their instructions in a bid to evade investigation in relation to offences and attempting to pervert the course of justice.
Solicitor Gavin Orr said Pickthall had been taking sleeping tablets and then had been out in the town.
He had been carrying the knife and accepted it was a stupid thing to do and ran off to throw it away.
Sheriff Scott Pattison told Pickthall that his record was concerning and only a custodial sentence was appropriate and jailed him for 30 months.