A novel optimal power and energy management (OPEM) for centralized hybrid energy storage systems (HESS) in microgrids is presented in this paper. The proposed OPEM aims at providing multiple grid services by suitably exploiting the different power/energy features of electrochemical batteries (B) and supercapacitors (S). The first part of the paper focuses on the design and analysis of the proposed OPEM, by highlighting the advantages of employing hand-designed solutions based on Pontryagin's minimum principle rather than resorting to pre-defined optimization tools. Particularly, the B power profile is synthesized optimally over a given time horizon in order to provide both peak shaving and reduced grid energy buffering, while S is employed in order to compensate for short-term forecasting errors and to prevent B from handling sudden and high-frequency power fluctuations. Both the B and S power profiles are computed in real-time in order to benefit from more accurate forecasting, as well as to support each other. Then, the effectiveness of the proposed OPEM is tested through numerical simulations, which have been carried out based on real data from the German island of Borkum. Particularly, an extensive and detailed performance analysis is performed by comparing OPEM with a frequency-based management strategy (FBM) in order to highlight the superior performance achievable by the proposed OPEM in terms of both power and energy management and HESS exploitation.ESS in several applications, their use for providing energy and power services is still quite limited. Considering supercapacitors, flywheel and superconducting magnetic ESS, they are very suitable for power services due to their fast dynamic response. However, supercapacitors suffer from very poor energy content, while flywheel and superconducting magnetic ESS are characterized by safety and cost issues respectively. Despite the specific types of ESS, a literature review reveals that a single ESS technology may not be suitable for providing both energy and power services. Consequently, ESS economic viability is still an issue for grid applications, especially due to high investment costs.In this regard, hybrid energy storage systems (HESS) represent a very promising solution; these consist of suitable combinations of both high energy and high power density ESS and thus, of ESS technologies characterized by complementary features [15][16][17][18][19][20]. Consequently, HESS can benefit from the advantages of different ESS technologies, resulting in enhanced performance compared to single ESS. Regarding the high energy density storage unit of the HESS, electrochemical batteries (B), compressed-air or hydrogen-based ESS are generally considered, which are characterized by an adequate energy capacity but relatively slow dynamic performance. It is also possible to make an HESS by combining B with compressed-air or hydrogen-based ESS [16,17]; in these cases, B act as the high power density storage unit due to superior dynamic performances and lower energy density c...