Ad Hoc networks for communication have completely replaced the existing communication technologies which are dependant on infrastructure. An attractive and widely utilized field in communication systems is Mobile Ad Hoc Networks or the MANETs which are a derivative of the conventional Ad Hoc Networks. Security of information communicated through MANETs as well as the robust nature of the network is a prime issue of concern and research in recent times. Amongst various attacks prevalent on MANET environment, packet flooding is a common attack and causes a devastating effect on MANET nodes which if left undetected may lead to consequent crashing of the entire network. Floodding attacks also tend to consume enormous energy well above the prescribed energy consumption limits per node resulting in lifetime reduction. Hence, detection of these malicious nodes and their differentiation from trustworthy nodes is taken as the research objective in this paper. This paper presents feature extraction anda classification model based on ANFIS (Adaptive Neuro-Fuzzy Inference System). By using ANFIS classifier, the extracted featureis trained and then classified.Further to counter the flooding cum energy preserving routing, this paper proposes a SMA integration with AODVprotocol called SMA2AODV to detect flooding attacks for MANETs. After detecting, the hybrid model ACO combined with FDR PSO for optimizing energy. ACO-FDR PSO identifies the energy-efficient routeand minimizes energy consumption in the network, toincrease node lifetime that ensures energy-efficient routing. The performance metrics like throughput, packet delivery ratio, attack detection ratio, and energy consumption areanalyzedby using the NS-2 simulator with existing benchmark methods.