Lee Ferguson's dog had to be subdued with PAVA spray after biting one officer on the right calf, and the other on the right forearm.

Two more officers were needed to tackle Ferguson after he shouted "Bite them! Bite them!" on Old Mill Lane, Barnsley, at 3.10am, on March 2, last year, prosecutor Richard Davies told Sheffield Crown Court.

He was seen arguing with his girlfriend and when two men tried to intervene, he shouted: "What the f*** are you looking at? Get out of your car and come here and I will have all of you."

Sign up to our daily newsletter The i newsletter cut through the noise Sign up Thanks for signing up! Sorry, there seem to be some issues. Please try again later. Submitting...

"He was extremely aggressive," said Mr Davies. "He was pulling hard on the lead and shouting at the dog."

One officer managed to get the lead off him and tied the dog up, but it chewed through the lead and attacked the officers.

They were left with abrasions, and had to get tetanus jabs. A three-and-a-half inch lock-knife was found on Ferguson.

He told police he carried the knife out of fear and said: "I have been jumped too many times and I am too old to fight back."

The court heard he had 20 previous convictions, including two for possession of a knife.

Becky Jane, mitigating, said: "The defendant would readily accept that he clearly overreacted and he is very sorry. He says he was caught off-guard.”

She said he had been a drug-user since he was 13 years old, and had suffered abuse which led to mental health problems.

"He was attacked in prison and on a number of occasions outside of prison," Ms Jane said, adding this made Ferguson "hyper-vigilant" which "compounds his disproportionate reaction to others."

Ferguson, 38, of Wentworth Close, Monk Bretton, admitted possession of a blade at magistrates' court, and pleaded guilty to affray before a trial.

Judge Sarah Wright noted that he was attempting to address his difficulties and was "motivated to change his life positively."