He was threatened with the gun and forced from his car before it was searched for anything of value.

The pair stole the terrified guard’s iPad and car keys, but the boy, linked to the car by fingerprint evidence, was arrested nearby with the fake gun.

At the time of the offence the youth was already on a suspended sentence for another robbery.

During that offence, the male victim was dragged to the floor by three attackers, kicked, and had his trousers pulled down to prevent him going after the muggers, who made off with his phone, wallet and credit cards.

Speaking to the judge in the latest case, Adam Lodge, defending, said the boy, who cannot be named for legal reasons, had endured a ‘troubling’ childhood.

The barrister added that the lad was so high on drink and drugs he had ‘blurred recollection’ of the robbery.

But he added that the prospect of having two children was ‘incentive for his client to tread different path in the future’, appealing for a sentence that would not crush the boy’s ‘determination’ to change.

But Judge Hilary Manley, sentencing, said there was no alternative other than custody.

Speaking to the boy as he went down, the judge said: “(The victim) didn't know if he was going to be shot - this was a cowardly frightening attack on a person going about his work.”