The hybrid renewable energy system, incorporating solar photovoltaic (PV) panels, a diesel generator, and battery storage, presents a sustainable and efficient approach to managing energy demands. This system ensures a reliable power supply for critical loads, optimizes renewable energy utilization, reduces dependency on fossil fuels, and lowers emissions. Key findings highlight its ability to effectively leverage solar resources and battery storage for stable energy provision, maintain operational continuity with diesel generator redundancy, and enhance system flexibility through dynamic energy management. Environmental benefits include reduced fuel consumption and minimized carbon emissions, contributing to cleaner energy generation. Cost-effective and adaptable, particularly during high renewable energy integration, this system demonstrates significant potential for implementation in regions with diverse renewable energy potentials, promoting energy efficiency, economic growth, and environmental sustainability. This study proposes optimal sizing approach for an islanded microgrid (IMG) to determines the optimal component sizes for the IMG, such that the life-cycle cost is minimized. The proposed algorithm takes advantages of the typical meteorological year-based simulation and an economic evaluation model is presented. The proposed sizing approach identifies the global minimum, and simultaneously provides the optimal component sizes as well as the power management strategies. This proposed optimization algorithm is examined in a typical islanded load in Baghdad, Iraq and the results is compared.