Advocate General for Scotland Richard Keen QC pleaded guilty to breaching section two of the Firearms Act 1968 by failing to secure a shotgun.
Lord Keen, a former chairman of the Scottish Conservative Party who was made a life peer in 2015, did not appear when the case called at Edinburgh Sheriff Court on Wednesday but he pleaded guilty by letter.
Sheriff Frank Crowe said: “I do take into account Mr Keen’s previous good record and the fact that he admitted his guilt at the outset.
“Nevertheless to hold a firearms certificate is a privilege and there are very strict conditions which have to be adhered to to prevent such weapons falling into the wrong hands.
“There was a potential risk with the shotgun not in the secure cabinet as laid down by the regulations.”
The court heard the offence came to light when police were called to a break-in at Lord Keen’s home on Ann Street, Edinburgh, on Hogmanay last year when he and his wife were away on holiday.
Officers searching the property found the 12 bore Stephen Grant shotgun in a basement out of its secure cabinet.
Solicitor advocate Simon Catto, representing Lord Keen, said he had been out shooting on December 27 and on returning home had taken the gun to the basement intending to clean it but had then “forgotten about it through his own carelessness” before departing for holiday on the 28th.
Mr Catto said Lord Keen had contacted police himself on Hogmanay after receiving a mobile phone alert that his alarm system had been triggered.
While the upper floors of the property had been ransacked, the burglars had not entered the basement area, he said.
Mr Catto said: “He’s a keen shot, he shoots approximately 10 times per year. He has been a shotgun enthusiast for around 25 years and has held a firearms certificate.
“He is therefore fully aware of what’s expected and required of him in terms of the certificate.
“He accepts on this occasion he fell below that.”