A taxi driver has been hailed a hero for foiling an attempted robbery by a young Swindon gunman.

Barry King grabbed the handgun from 19-year-old Kevin Clarke when he entered Merlin Cars in the Portfield Estate in Marlborough after distracting him.

Following a struggle he managed to wrench it away from the teenager who fled empty-handed.

Clarke, from William Street, Swindon, was sentenced to four years and nine months in a young offenders institution for attempted robbery, possessing an imitation firearm with intent to commit an offence, trying to pervert the course of justice and criminal damage.

Salisbury Crown Court Judge David Maclaren Webster told him: "Society needs to be protected from you."

The court heard that Clarke arrived at Merlin Cars, a taxi office, last September, brandishing the gun which was later revealed to be a fake.

Prosecuting counsel John Upton said the teenager thrust the weapon a couple of inches from Mr King's right eye and demanded money.

He said it was traumatic for Mr King and taxi office worker Margaret Smith who was also in the building because they had not realised the weapon was a fake.

Told there was no money, Clarke asked for any cash the pair had on them saying: "I am serious."

Quick thinking Mr King told him: "So is the policeman coming down the path."

As Clarke turned slightly, Mr King grabbed his wrist and succeeded in breaking his grip on the gun. Clarke then ran off and, although chased by Mr King, got away.

When later questioned, Clarke at first denied being involved but subsequently "expressed sorrow and remorse," Mr Upton said.

He told the court that on another occasion, Clarke smashed a window when refused entry to The Lytton Tree public house in Swindon, causing £1,000 damage, and also gave police a false name.

Defending, Marcus Davey said Clarke's attempted robbery was "bungling and inept".

He said it was partly done to show off to his friends and partly to get money for drugs because he was at that time a heroin user.

Mr Davey said Clarke, who has since stopped using drugs, needed money to pay serious drug debts.

Mr King's bravery in foiling the robbery has been praised by his boss.

Peter Hillier, the owner of Merlin Cars, said: "He did a really good job for us that day."