He said that the boy had realised the enormity of what he had done almost as soon as he had carried out the robbery.

"The victim, although terrified, did actually push the gun away at one point," he said.

Mr Hepburn-Scott said his client had staged the robbery to raise cash to pay off a drug debt.

"He owed a dealer money for cannabis," he said.

Mr Hepburn-Scott said his client was frightened of possible reprisals.

But he said the boy had now stopped hanging out with drug-taking friends who had exerted negative peer pressure on him.

"His parents who are intelligent and articulate people are shocked and appalled by what has happened," he said.

"He is anxious to apologise to his victim."

The defendant's father told the court: "He had been hanging around with the wrong crowd and he was taking skunk [cannabis]. But he's changed back again now. The shock of all this has turned him around."

The defendant pleaded guilty to robbery and using a gun in the commission of a crime.