A police dog sniffed out a sub machine gun during an operation to target a known Leeds drug dealer.
Jordan Williams, 23, was sentenced to six and a half years over the discovery of the weapon and ammunition at a property on Roundhay Road.
A jury heard Williams has served prison sentences for drug dealing offences and was arrested on September 19 last year after officers saw him acting suspiciously.
Williams parked his car outside his girlfriend’s house and was seen coming in and out carrying items.
Officers searched the property and a West Yorkshire Police dog called Bella found a sports holdall under a kitchen sink.
The bag contained the sub-machine gun and live ammunition.
Williams, of Marlborough Gardens, Woodhouse, claimed that the weapon belonged to his girlfriend during a trial at Leeds Crown Court.
He was found guilty of possession of a prohibited firearm and possession of ammunition without a firearms certificate.
During the trial the court heard Williams had been stabbed in an attack months before the incident but had refused to tell police about what happened to him. Recorder Tahir Khan, QC, said he could only guess as to the whether Williams had the weapon in relation to the attack or if it was connected to his drug dealing activities.
He said: “What is abundantly clear is that you lied not only to avoid being connected to this serious offence but you did everything you could to get your girlfriend convicted of offences she was entirely not guilty of. Not only were you lying to save yourself but you were trying to get her into trouble for something she had not done. You have fought this case tooth and nail from start to finish.
“You have not shown any remorse for what you have done.”