This paper proposes a novel hierarchical optimal control framework to support frequency and voltage in multi-area transmission systems, integrating battery energy storage systems (BESSs). The design is based on the coordinated active and reactive power injection from the BESSs over conventional synchronous generator-based control for fast and timely mitigation of voltage and frequency deviations. The principle of this new idea is to use two. This paper proposes a novel hierarchical optimal control framework to support frequency and voltage in multi-area transmission systems, integrating battery energy storage systems (BESSs). The design is based on the coordinated active and reactive power injection from the BESSs over conventional synchronous generator-based control for fast and timely mitigation of voltage and frequency deviations. The principle of this new idea is to use two hierarchical schemes, one physical and one logical. The objective of the first scheme prioritises the power injection from the BESSs installed in the area where a contingency occurs, consequently reducing the disturbance of the dynamics in the neighbouring areas. In the second scheme, operational rules for aggregated BESSs in each are incorporated, increasing the safety of the asset. The proposed approach exploits the advantages of time-synchronised measurements, the eigensystem realisation algorithm (ERA) identification technique, the optimal linear quadratic Gaussian (LQG) controllers and a new aggregating agent that coordinates the power injection of BESSs in a hierarchical and scalable scheme to precisely regulate frequency and voltage of modern transmission grids, increasing their reliability and stability. The feasibility and robustness of the proposal is demonstrated using simulated scenarios with significant load changes and three-phase, three-cycle faults on a modified Kundur-system with four interconnected areas, mitigating frequency. ••Real-time, optimal and hierarchical controller provides voltage and frequency support.••Optimal power injection by smartly clustered BESSs mitigates power supply imbalances.••The aggregator agent adds smart logical functions for information handling.••The real-time controller regulates voltage and frequency deviations in 450 ms.••The. Coordinated controlEigensystem realisation algorithmBattery energy storage systemsHierarchical controlAGC Automatic generation controlARE Algebraic Riccati equationBESS Battery energy storage systemBMS Battery management systemDER Distributed energy resourcesERA Dynamics in traditional power systems are primarily dominated by the actions of synchronous generators (SGs),. However, the increasing spread of distributed energy resources (DERs), renewable energy systems and the connection of nonlinear loads with fast time-constants triggers undesired dynamics that droop control and automatic generation control (AGC) systems are unable to handle, impacting the stability and reliability of modern power grids,,,. Thus, this fact motivates the suitable combination of both SGs and battery energy storage systems (BESSs) acting synergistically through novel control schemes that prioritise, in an accurate and a fast way, the power dispatch. The BESSs can significantly improve the performance and security of transmission networks, improving the voltage and frequency transient responses,. Likewise, it is also mandatory to bring both responses within the voltage and frequency limits, as shows in Fig. 1, according to the establishment in the standard ANSI,.Recent contributions highlight the application of BESSs for frequency and voltage support in power transmission networks,. In, a real-time controller that formulates the power command sets as an optimisation problem is experimentally validated, this considers the converter capacity and BESS safety constraints to provide ancillary services towards power grids. In, [1.