The Internet of Things (IoT) is one of the emergent technologies with advanced developments in several applications like creating smart environments, enabling Industry 4.0, etc. As IoT devices operate via an inbuilt and limited power supply, the effective utilization of available energy plays a vital role in designing the IoT environment. At the same time, the communication of IoT devices in wireless mediums poses security as a challenging issue. Recently, intrusion detection systems (IDS) have paved the way to detect the presence of intrusions in the IoT environment. With this motivation, this article introduces a novel Quantum Cat Swarm Optimization based Clustering with Intrusion Detection Technique (QCSOBC-IDT) for IoT environment. The QCSOBC-IDT model aims to achieve energy efficiency by clustering the nodes and security by intrusion detection. Primarily, the QCSOBC-IDT model presents a new QCSO algorithm for effectively choosing cluster heads (CHs) and organizing a set of clusters in the IoT environment. Besides, the QCSO algorithm computes a fitness function involving four parameters, namely energy efficiency, inter-cluster distance, intra-cluster distance, and node density. A harmony search algorithm (HSA) with a cascaded recurrent neural network (CRNN) model can be used for an effective intrusion detection process. The design of HSA assists in the optimal selection of hyperparameters related to the CRNN model. A detailed experimental analysis of the QCSOBC-IDT model ensured its promising efficiency compared to existing models.