Martin Duffy, 42, and David Marsh, 50, drove a VW Golf into the Spar shop on Falsgrave Road in the early hours of March 7, before stealing hundreds of pounds’ worth of spirits and vaping equipment.
But they were soon arrested as police patrol officers from the Firearms Unit just happened to be on the other side of the road, moving rubbish bins, York Crown Court heard.
The two drug addicts had to be Tasered before being arrested, said prosecutor Jade Edwards.
She said that police in an unmarked car were on patrol just after 2am when they stopped to move some bins on the other side of Falsgrave Road.
As they did so, the VW reversed onto the opposite footpath.
The two men initially tried to smash the glass in the front door with hammers to get into the shop, but this appeared to fail.
“Officers got back in the vehicle…and saw two males pulling a large white bag through the broken glass of the shop door,” added Ms Edwards.
They loaded the bag into the boot of the Volkswagen, which had no registration plates, and one of the men was trying to force a “large sack” into the passenger side.
They then reversed the car into the shop door in a “ram-raid-style” attack and stole 31 bottles of spirits worth over £394, as well as 30 vape bottles worth just over £190.
On arresting the men, officers found a lump hammer in Duffy’s jacket pocket and a second hammer was found inside the shop.
CCTV footage showed the vehicle smashing the window and the ram-raiders then “pushing to force it through, before entering with large white rubble sacks (and) filling them”.
The shop window was “completely shattered”, causing £10,000 damage.
Marsh owned up straight away and told police that personal and family problems had “pushed him over the edge and he would rather be in jail”.
“He said they initially went to smash the window with hammers (but that) didn’t work, so they decided to ram the shop,” added Ms Edwards.
Duffy, of Scalby Road, Scarborough, initially made denials and even claimed that the offence should be charged as attempted burglary because all the stolen goods had been recovered.
However, both men ultimately admitted burglary and appeared for sentence on Thursday, May 26.
Ms Edwards said Duffy had 30 previous convictions for 45 offences including burglary, theft and kindred.
Marsh, from Scarborough but of no fixed address, had an even worse record, his 123 previous offences including many for burglary.
His last prison sentence for a house burglary and shop theft was in September 2019, when he was jailed for over two years.
Angus Macdonald, for Duffy, said his client had a long-standing addiction to heroin and had relapsed just before the attack on the shop.
He said Duffy had “fed his habit” over the years by stealing but was now getting help for his addiction.
He said that Duffy, a father-of-one, planned to move to Durham to be with his family when he was released from prison.
Jim Littlehales, for Marsh, said his client had been addicted to heroin since he was a young man.
This had led to mental-health problems and his becoming “almost institutionalised” following a series of prison sentences.
Jailing Duffy for 22 months, judge Simon Hickey told him that “drugs ruin lives and this is a classic case”.
Jailing Marsh for two years, Mr Hickey said his record made his offence “significantly worse”.