It was the second time in six years that Robert McConnell, 42, had been jailed for peddling Class A drugs in the town, York Crown Court heard.
Police officers spotted McConnell talking to a woman at the top of Market Way, near the Boyes department store, at about 8pm on September 24, said prosecutor Rachael Landing.
He was followed by the officers as he walked towards Eastborough, but he then turned into the One Stop shop.
McConnell walked past staff to the back of the shop as officers with body-worn cameras followed him in.
The officers positioned themselves at either end of the alcohol aisle to block McDonnell in.
He tried to walk past them, but he was stopped and searched.
“He told officers he was in a rush and repeatedly shouted, ‘I didn’t run’,” added Mrs Landing.
They found a set of scales on him and a bag of heroin weighing 13.7g, but he claimed they weren’t his.
During his arrest, McDonnell became violent and lunged at the officers.
He aimed a volley of expletive-ridden abuse at them and shouted: “I’m going to butt you in a minute.”
Back-up officers had to be called in as McConnell “tensed up” and swore at officers.
They eventually managed to force him into the police vehicle.
Officers were convinced that what they had found on McConnell was not the full picture and searched his house.
They found nothing there, but McConnell told them he had hidden other drug packages at the shop where he was arrested and was worried that children may pick them up.
Officers returned to the shop where One Stop staff said they had found a box of white powder which turned out to be just under 3.5g of cocaine.
Police also found a yellow Kinder Egg container at the back of the store, inside which were eight heroin wraps.
A total of 15g of heroin, with a street value of about £700, were found during McConnell’s arrest and the police search at the back of the shop.
They also seized £135 from him and two mobile phones on which they found messages or “broadcasts…informing people that the best product in town would be available when he was next in town”, said Mrs Landing.
McConnell, of St Leonard Crescent, Scarborough, was charged with two counts of possessing a Class A drug with intent to supply and admitted both offences.
He appeared for sentence via video link on today (Nov 23).
Mrs Landing said McConnell had 16 previous convictions for 23 offences, eight of which were drug matters.
In September 2015, he was jailed for three years and nine months for supplying heroin and crack cocaine.
In November last year, he was jailed for 12 weeks for possessing a Class C drug with intent to supply and driving while disqualified.
Emma Hughes, mitigating, said McConnell had “significant” mental-health issues and was a heavy user of heroin and cocaine.
Judge Simon Hickey slammed McConnell for his abuse of and aggressive behaviour towards police and “your determination to hide and get rid of the items”, although he noted that the father-of-two had told officers that he wanted the drugs he had hidden at the shop to be found because he was worried that children would pick up the Kinder Egg.
Jailing him for three years and four months, the judge said McConnell had played a “significant role…dealing Class A drugs in Scarborough, a town with a significant drug problem, with a significant number of people hooked on (Class A drugs)”.
McConnell will serve half of that sentence behind bars before being released on prison licence.