A rat trap (1) comprising a power supply (80) and means (3) for killing a rat and a first sensor adapted to detect the presence of a rat in the space within the reach of the killing means and where control means are arranged capable of receiving a signal from the first sensor, and being adapted for activating the killing means (3) to kill the rat when the presence of the rat is detected by the sensor according to the invention the trap further comprise a second sensor (85) for detecting light, and the control means is capable of receiving a signal from the second sensor and being adapted for deactivating the killing means (3) or the first sensor for a period of time after the detection of light by the second sensor. Hereby it is possible to prevent accidents due to e.g. erroneous activation of the trap in case of ordinary localised work illumination, including e.g. also in daylight at ground level or in artificial work illumination at the bottom of a shaft.