Under the Badger Protection Act 1992, it is an offence to kill a badger or to interfere with its ancestral home, except under certain circumstances.
But PQ 148663 Jan 20 2004 (archived) describes exemptions to the Act, under which badgers may be lawfully killed. We quote the Minister's answer in full:
Section 6 - General exeptions.
Where a seriously ill badger is killed as 'an act of mercy'
Where a badger is unavoidably killed or injured as an incidental result of a lawful action.
Experimental procedures under license, to advance biological / behavioural knowledge etc.
Section 7 - the Farmer's defence .
A person is not guilty of an offence by reason of killing a badger if the action was necessary for the
purpose of preventing serious damage to land, crops, poultry or any other form of property.
This defence cannot be relied upon if it was apparant before that time that action would prove
necessary and a licence had not been applied for as soon as reasonably practicable, or where
application for such licence had been determined.
Section 10 - Licences
Licences may be granted to permit badgers to be killed for the following purposes:
Scientific or educational purposes or the conservation of badgers.
Preventing the spread of disease.
Preventing serious damage to land, crops, poultry or any other form of property.
The Act is available online at: www.legislation.hmso.gov.uk/acts/acts1992/Ukpga 19920051 en 1.htm.