A Trowbridge man who had tried to rob a convenience store at knifepoint flagged down police racing to the scene and handed himself in.
Mark Weston was fleeing from Hillworth Stores, in Devizes, following a failed raid when he saw a patrol car which had been called to the scene.
When the officer stopped the 33-year-old said 'It was me, I did it. I'm sorry,' before adding 'Times are hard. I'm sorry'.
Anita Gibson-Lee, prosecuting, told Swindon crown court how Maria Johnson was behind the counter in the shop she runs with her partner on Sunday May 3.
At about 2.30pm a man came in and asked 'Can you do me a favour,' before putting his hand inside his jacket and producing a large kitchen knife.
He held the weapon about two feet from her face and demanded 'Give me the money,' as he jabbed the eight inch blade towards her.
Mrs Johnson shouted 'No' and then began screaming causing partner Steve Nicholls to come running out from the back room where he was working.
Meanwhile the knifeman fled the store empty handed and was seen running off along Hillworth Road.
He was detained after flagging down the officers and when they asked him where the knife was he showed them where he had thrown it into a field.
Weston, of Bradley Road, Trowbridge, pleaded guilty to attempted robbery and possessing a bladed article.
Miss Gibson-Lee said as a result of the incident Mrs Johnson felt vulnerable in the shop, not only for herself but for other female members of staff.
Alex Daymond, defending, said at the time of the raid he client was 'in a fairly low emotional state'.
He said his grandmother had recently died and he had also split from his long term partner and was facing eviction for rent arrears.
Although the incident would have been terrifying he said that he had not gone through with it and never planned to hurt anyone with the knife.
And when the police arrived on the scene he handed himself over before pleading guilty at the first opportunity.
He said it was not a sophisticated offence as he had made no attempt to disguise himself and ran off when confronted.
Jailing him for 28 months Judge Douglas Field said: "You demanded money from her and you intimidated, indeed petrified, her by waving this blade in her face.
"She had the resolve not to immediately hand over the money. She stood her ground and screamed and you then left.
"Shortly after the police arrived on the scene and you waved them when you saw them.
"These offences against convenience stores are treated by the courts as very serious. They are vulnerable premises particularly when run alone and the lady here is to be commended for her bravery."