## 1 Introduction  
Wireless network transition from 4G to 5G, laying the groundwork for subsequent generations of wireless systems in the future, brings great enhancements in speed, lowering latency, and increasing potential to connect with billions of devices. These capabilities serve as the cornerstone for cutting-edge applications spanning the Internet of Things (IoT), smart cities, autonomous systems, and remote healthcare. However, the defining characteristics of next-generation networks, such as extensive connectivity, high heterogeneity of devices, and flexible architectures, also heighten their vulnerability. The broadened attack surface and constantly shifting threat landscape mean that traditional security approaches often struggle to counteract sophisticated cyberattacks meticulously tailored for 5G and beyond [1, 2]. From critical healthcare networks to vehicular communications, the repercussions of a network breach can be grave, underscoring the necessity for more dynamic and proactive security mechanisms. Machine learning (ML) has rapidly emerged as a compelling solution to enhance the detection, prevention, and mitigation of security threats in current and next-generationwireless networks. By scrutinizing voluminous and continuous streams of network data, ML-based systems can rapidly unearth anomalies and evolve to counter newly emerging threats [3; 4]. Reinforcement learning models have demonstrated the ability to refine defense strategies on the fly, particularly in environments characterized by heterogeneous IoT devices and ever-shifting traffic patterns [5]. Through adaptive learning, these systems can effectively allocate network resources to protect mission-critical areas, identify zero-day vulnerabilities, and respond quickly to malicious activity. Accompanying these technological advances, the regulatory environment has become a vital part in determining the deployment of ML-based security solutions. The European Union Artificial Intelligence Act provides a harmonized regulatory framework for artificial intelligence across the EU, specifically in the classification of AI technologies according to the risk level associated with them. Given that the context of telecommunications is classified as a critical infrastructure, this fact could impose stringent demands on testing, explainability, and lifecycle management for ML-based security tools [6]. Such obligations underscore the importance of transparency, accountability, and resilience in AI-driven solutions, particularly when they are responsible for safeguarding pivotal infrastructures. In response to all these challenges, we introduce WIDA--a conceptual, ML-driven algorithm designed to provide adaptive anomaly detection--tailored to the unique demands of 5G and future 6G networks. Our approach aims to automate key stages of threat detection while ensuring compliance with regulatory standards such as the EU AI Act. Although currently presented as a prototype rather than a fully deployed system, WIDA demonstrates how surveyed ML techniques can be effectively integrated to bolster wireless network security. The main novelty of this work is threefold: first, we propose an adaptive ML-driven security framework that aligns key 6G security drivers with a layered architecture, leveraging advanced ML techniques to address the unique challenges of current and next-generation wireless networks; second, we propose an optimized Wireless Intrusion Detection algorithm seamlessly integrated within this framework aimed at enhancing security. The third fold focuses on bridging the gap between cutting-edge technology and evolving legal frameworks, demonstrating how regulatory scrutiny influences the design and lifecycle management of ML-based security systems. The structure of this paper is organized as follows: Section 2 lays out the Architectures of 5G and 6G, providing a structural basis for subsequent discussions on intrusion detection. Also, it introduces a security framework developed for software-based infrastructures.