Objective: Wormhole attack is a serious threat to Wireless Sensor Networks (WSN) due to its wireless broadcast nature of communication, multi hop nature and resource constraints. Hence, to enhance the security and energy efficiency of a WSN, energy efficient Intrusion Detection System (IDS) is needed to detect and mitigate the attacks. In this paper, an Energy Efficient Intrusion Detection System (EE-IDS) has been proposed for IEEE 802.15.4 based WSN to detect and mitigate the effect of wormhole attacks. Methods/Statistical Analysis: The wormhole attack is detected by using the optimized watchdog system. The optimized watchdog mechanism is a trust based method which is used to evaluate the validity of all the nodes of the network. In proposed approach, the optimization has been done in the selection of watchdog nodes, in order to consume less energy compared to that of the existing approaches. The detection of wormhole attack is also completely relies on the three main factors like trustworthiness, packet delivery ratio and end-to-end delay. Findings: The proposed EE-IDS is examined through extensive simulations by considering static and mobility model, and then it is compared with the existing IDS for detecting wormhole attacks. The performance of zigbee WSN is analyzed in terms of metrics such as packet delivery ratio, average end-to-end delay and energy consumption for static model. In mobility model, the Proposed EE-IDS is evaluated in terms of detection rate, false positive rate and detection time. Application/ Improvements: The proposed EE-IDS is used to detect the wormhole attack and improve the energy efficiency in zigbee based wireless sensor networks, which can be used for military, environmental, health and commercial applications.