A Protocol for Intrusion Detection Based on Learning Automata in Forwarding Packets for Distributed Wireless Sensor Networks In recent years, wireless technology has enjoyed a tremendous rise in popularity and its usage opens new fields of applications. Due to their possible deployment in remote locations for civil, educational, scientific, military purposes and security which includes intrusion detection and intrusion prevention are of utmost importance. Distributed wireless sensor networks have problems on detecting and preventing malicious nodes which always bring destructive threats and compromise multiple sensor nodes. Therefore, sensor networks need to support an authentication service for sensor identity and message transmission. Furthermore, intrusion detection and prevention schemes are always integrated in sensor security appliances so that they can enhance network security by discovering malicious or compromised nodes. In this paper, we propose an energy-aware protocol for intrusion detection in wireless sensor networks (WSNs). Detection system is implemented based on learning automata concept. We implemented the system in network simulator “GloMoSim”. Also we have rigorously evaluated the performance of our proposed solution by performing a variety of experiments and have found our solution approach to be promising.