Police took away 12 firearms after a search at the premises and bomb experts were checking that the barrel device was safe. It was in an outhouse which had previously been broken in to at the home of Len Fountain, 68, from Boylestone, Derbyshire.
Mr Fountain is being treated in Burton Hospital. His injuries are not said to be life threatening.
Police said it appeared Mr Fountain set up the device but walked into the building and triggered it. His wife, Mabel 63, called police.
Inspector Glen Wicks, of Derbyshire Police, said: The bomb squad from Chilwell, Nottinghamshire, have been called to make sure the device is safe and to check the grounds to see if there are any further booby traps."
After searching the property, around 12 firearms were taken away for examination.
Insp Wicks added: Obviously as soon as he is out of surgery and able to, we will be talking to him about this incident. The police investigation so far indicates that he had set up a firearm and an explosive device to deter intruders."
Detective Sergeant Steve Wain, of Derbyshire police, said at the scene: "Earlier today police attended a house after reports that a man had received an injury to his right leg, just above the knee as a result of a gunshot.
"A search of an outbuilding used to store tools revealed a crude home- made device comprising a barrel and wire connected to the shed door."
DS Wain said: "Mr Fountain, a self-employed agricultural contractor, had been the victim of a burglary in the past. We believe the premises were attacked about a year ago - the same shed was broken into."
But he added: "This is not a particularly high crime area but this is an isolated spot."
Mrs Fountain was being comforted by the couple's daughter inside the house.Reuse content