A man who held up an insurance office was caught after confessing his crime to the taxi driver who drove him away from the crime scene.
Joseph Currie, 46, hailed a black cab shortly after robbing Jim Blair Insurance in Shawlands, Glasgow, with an imitation sawn off shotgun on February 28.
The High Court in Edinburgh heard that Currie was perspiring heavily when he climbed into the car.
The driver asked him: "What's wrong, mate? Have you just robbed a bank?" Currie replied: "Yes."
The court heard that Currie, who has three previous convictions for assault and robbery, was subsequently apprehended by the police.
His shotgun was then revealed to be two lengths of pipe tied together by tape.
The revelations emerged in a High Court hearing on Thursday in which Currie was jailed for seven years and ten months.
Judge Lord Pentland also ordered Currie, a prisoner of HMP Barlinnie, to be supervised by the authorities upon his release from prison for another five years.
Lord Pentland also ordered Currie to serve the remaining 2109 days of a sentence imposed earlier and from which he was paroled in January. This will be served consecutively to his latest sentence.
Currie had pleaded guilty to an assault and robbery charge at the High Court in Glasgow in June and sentence had been deferred for Lord Pentland to obtain reports about his character.
At the earlier hearing, the court heard how Currie told staff at Jim Blair Insurance in Kilmarnock Road, Glasgow: "I have a package for you – a sawn-off shotgun. This is not a joke. Give me money."
Minutes later Currie, from Mount Florida, Glasgow, told them: "I've been robbing banks for 20 years and I've not shot anybody yet."
The court heard that Currie made off with £2773.45 in cash and was seen walking towards Shawlands Cross.
Prosecutor Martin Macari told the court that Currie has a number of previous convictions for assault and robbery, including High Court convictions. Mr Macari said Currie threatened to shoot the staff if they failed to comply with his demands for money.
Mr Macari added: "In the days before this offence he appears to have been taking heroin and alcohol."
During the raid he also told staff: “I don't want money with dye and don't press any panic buttons."
After the robbery Currie discarded the clothing he wore and the imitation firearm. When he was questioned by police he led them to the bin in Norfolk Street, Glasgow, where he had dumped these items.
On Thursday, defence QC Murray Macara told the court that his client was apprehended after he took a taxi from Shawlands Cross towards Glasgow City Centre.
Mr Macara said: "After getting into the taxi, the driver made a joke and asked him 'What's wrong mate? Have you just robbed a bank?' "He responded 'yes'."
Mr Macara said his client suffered from bipolar disorder and had not been taking his medication at the time of the robbery.
Mr Macara added: "He became manic. He enjoys the feeling of being manic. If he had taken his medication then he perhaps would not have committed this offence. He had spent the evening before the robbery at a party where he took alcohol and drugs."
At this juncture, Currie shouted at Lord Pentland from the dock, saying: "I'm easily led, your honour."
Passing sentence, Lord Pentland told him that he had no other option but to send him to prison.
He added: "You have pleaded guilty to an extremely serious offence. This must have been a terrifying experience for the staff there. You presented what appeared to be a sawn off shotgun and threatened to shoot them.
"You also have numerous convictions for assault and robbery. I am going to impose an extended sentence."