Steven Wilkinson, 44, was pulled over by officers in Springburn, Glasgow, on August 24.
Asked if there was anything in his car that could hurt them when they searched the vehicle, Mr Wilkinson said there was a gun in the front passenger seat.
He was sentenced at the High Court in Glasgow today after pleading guilty to five charges under the Firearms Act.
Mr Wilkinson was caught with the Skorpion pistol - used by security forces and terror groups around the world - when officers went to a property in East Kilbride on another matter unconnected to him.
They saw a car drive away and the vehicle was traced to Springburn where Mr Wilkinson got out of the vehicle looking agitated.
Police recovered the gun as well as a magazine and silencer.
Nicky Patrick, procurator fiscal for homicide and major crime, said: “Possession of illegal firearms, particularly of this calibre, is extremely serious, but thankfully rare in Scotland.
“Police and prosecutors are working together to do all in our power to prevent these crimes and to bring those who commit them to justice.”
Mr Wilkinson pleaded guilty to the firearms charges at the High Court in Glasgow on November 30.