The pressing environmental concerns associated with fossil fuels have propelled renewable energy sources, particularly solar and wind energy, into a more prominent position. This article aims to explore an optimal configuration and conduct a technical and economic analysis of a hybrid solar-wind energy system tailored for electrifying Laayoune city. This system, equipped with hydrogen tank and batteries as storage devices, aims to meet the annual energy requirements of residential areas estimated at 310.87 GWh/year. In addition to addressing energy needs, the study tackles significant challenges such as reducing dependence on traditional energy sources, curbing greenhouse gas emissions, and bolstering energy security in the region. Utilizing HOMER Pro software, the research evaluates various combinations of renewable resources, including solar and wind, alongside storage solutions such as batteries, fuel cells, and hydrogen storage, to find the most viable solution in terms of electricity generation, cost, and environmental impact. The findings highlight a hybrid configuration comprising solar, wind, battery, grid, and converter components as the most cost-effective approach for Laayoune's renewable energy system. This integrated system not only yields an energy cost of 0.0477 $/kWh and a net present cost (NPC) of 336 M$ but also generates 627.69 GWh/year of energy. Furthermore, it achieves a 100% renewable energy ratio while completely eliminating CO2 emissions.