In a well clustered mobile ad hoc network, the cluster head plays a vital role in communicating with all the nodes. The stability of the cluster head and integrity of the cluster head are important for secured communication as the rest of the nodes in the network are depending on the cluster head. The stability of the clustered network can be increased by making the cluster head more stable and reliable entity. The mobile agents are introduced in the network which has the capability to check whether the cluster head elected is having the largest residual power among all the nodes in that particular network. The novel intrusion detection system is detecting the selfish nodes and the malicious nodes.