A career criminal wore a Scream mask and was armed with a sword when he tried to rob a West Yorkshire phone store.
Nassar Khan was handed an extended prison sentence of eight years over the raid at Pulse phone store in Dewsbury.
Khan and accomplice Matthew Smith targeted the store on November 6 last year at the business premises on Huddersfield Road.
Leeds Crown Court heard Khan, 40, was wearing a Scream mask when he went into the store and pulled a sword out of his trousers.
Smith, also 40, was carrying a hammer.
Andrew Horton, prosecuting, said the owner was in the shop with an elderly customer at the time of the raid.
He jumped over the counter and pulled the customer out of the store.
Mr Horton said Smith dropped the hammer and ran away but the owner managed to lock Khan inside the store.
Other shop owners then came to help and they detained Khan inside the shop until police arrived to arrest him.
The prosecutor said: “Khan offered them his expensive watch to let him go.”
Smith handed himself in to police the following day.
Both men pleaded guilty to attempted robbery and possession of an offensive weapon.
The court heard Khan has previous convictions for robbery and possessing weapons.
He was given an eight-year sentence in 2009 for a professional robbery in which a driver was tied up and threatened with a gun by men who stole a safe from his vehicle.
Peter Byrne, for Khan, said his client’s offending was linked to heroin addiction.
Khan, of Centenary Square, Thornhill, was told he must serve a five-year custodial term followed by an extended three-year licence period.
Recorder Dafydd Enoch, QC, told Khan: “You are prepared to resort to violent crime to feed your habit.
“I have no doubt you present a significant risk to the public.”
The court heard Smith agreed to take part in the offence at a time when he was homeless and needed money to pay for drugs.
He was jailed for four years.