This paper addresses the optimal sizing of Hybrid Renewable Energy Systems (HRESs), encompassing wind, solar, and battery systems, with the aim of delivering reliable performance at a reasonable cost. The focus is on mitigating unscheduled outages on the national grid in Iraq. The proposed On–off-grid HRES method is implemented using MATLAB and relies on an iterative technique to achieve multi-objectives, balancing reliability and economic constraints. The optimal HRES configuration is determined by evaluating various scenarios related to energy flow management, electricity prices, and land cover effects. Consumer requirements regarding cost and reliability are factored into a 2D optimization process. A battery model is developed to capture the dynamic exchange of energy among different renewable sources, battery storage, and energy demands. A detailed case study across fifteen locations in Iraq, including water, desert, and urban areas, revealed that local wind speed significantly affects the feasibility and efficiency of the HRES. Locations with higher wind speeds, such as the Haditha lake region (payback period: 7.8 years), benefit more than urban areas (Haditha city: payback period: 12.4 years). This study also found that not utilizing the battery, particularly during periods of high electricity prices (e.g., 2015), significantly impacts the HRES performance. In the Haditha water area, for instance, this technique reduced the payback period from 20.1 to 7.8 years by reducing the frequency of charging and discharging cycles and subsequently mitigating the need for battery replacement.