A dad-of-two was jailed for five years after he was caught with a gun and drugs.
Police discovered the converted replica revolver and a cache of cocaine during the search of a garage used by Liam McCaig in Dyce, Aberdeen.
The High Court in Edinburgh heard the premises were rented from the local authority by another man, who was told by McCaig that he wanted to use it to store motorbikes.
A judge told McCaig, 23, that a significant amount of drugs were involved and pointed out that the firearms offence carried a minimum term of five years in prison.
Lord Brailsford then jailed McCaig for five years.
McCaig had denied the illegal possession of the revolver and being concerned in the supply of the Class A drug on May 22 last year at an earlier trial but was convicted of the offences.
Defence counsel Matt Jackson said: “He maintains his innocence.”
McCaig had claimed that someone bore a grudge against him and he was set up.
Keep up to date with the latest news with The Evening Express newsletter
Police found the gun and drugs, which had a potential to make £33,000 on the streets, along with a machete and knives during a search of the premises at a garage site at Berrywell Road.
The court heard that DNA and fingerprint evidence helped link McCaig to the crime.
Mr Jackson said McCaig has abused cocaine in the past and had an issue with alcohol.
The defence counsel said McCaig suffered from anxiety and depression and was diagnosed with ADHD as a teenager.
DCI Fionnuala McPhail, from Aberdeen CID, said: “This conviction serves as yet another example of our commitment to tackle the supply of drugs into the north-east, as we continue to target those we suspect to be involved in the supply chain.
“I would like to take this opportunity to remind people that information from our local communities is absolutely essential for our investigations and we are grateful to the public for every piece of information which is used to disrupt the drugs trade.”