INTRODUCTION: MANET is an emerging technology that has gained traction in a variety of applications due to its ability to analyze large amounts of data in a short period of time. Thus, these systems are facing a variety of security vulnerabilities and malware assaults. Therefore, it is essential to design an effective, proactive and accurate Intrusion Detection System (IDS) to mitigate these attacks present in the network. Most previous IDS faced challenges such as low detection accuracy, decreased efficiency in sensing novel forms of attacks, and a high false alarm rate. OBJECTIVES: To mitigate these concerns, the proposed model designed an efficient intrusion detection and prevention model using COOT optimization and a hybrid LSTM-KNN classifier for MANET to improve network security. METHODS: The proposed intrusion detection and prevention approach consist of four phases such as classifying normal node from attack node, predicting different types of attacks, finding the frequency of attack, and intrusion prevention mechanism. The initial phases are done through COOT optimization to find the optimal trust value for identifying attack nodes from normal nodes. In the second stage, a hybrid LSTM-KNN model is introduced for the detection of different kinds of attacks in the network. The third stage performs to classify the occurrence of attacks. RESULTS: The final stage is intended to limit the number of attack nodes present in the system. The proposed method's effectiveness is validated by some metrics, which achieved 96 per cent accuracy, 98 per cent specificity, and 35 seconds of execution time. CONCLUSION: This experimental analysis reveals that the proposed security approach effectively mitigates the malicious attack in MANET.