Delivering sustainable power to rural communities in sub-Saharan Africa, particularly in Somalia, where many areas are far from the electrical grid and suffer from energy shortages, necessitates the deployment of appropriate technologies. This study evaluates the techno-economic and environmental viability of a hybrid renewable energy system (HRES) comprising a 15 kWp photovoltaic (PV) generator, 10 kW wind turbine (WT), 25 kW diesel generator (DG), and a 72-kWh battery energy storage system (BESS). The HRES is proposed to supply sustainable power to a rural community in Somalia. The techno-economic assessment of the proposed HRES and a comparative analysis of other configurations—namely the PV/WT/BESS and PV/DG/BESS systems is conducted using HOMER and MATLAB software. The results indicate that the proposed PV/WT/DG/BESS HRES demonstrates superior techno-economic performance compared to the other configurations. The lowest net present cost of $96,899.16 and the levelized cost of energy (LCOE) of $0.090/kWh were achieved. This system attains 25 % excess electricity, maintains a 0 % unmet electric load, and demonstrates robust environmental performance with a renewable penetration rate of 91.8 %. Approximately 53.34 % of greenhouse gas emissions are reduced compared to the PV/DG/BESS configuration. The study confirmed the significant impacts of all sensitivity parameters on operational costs, LCOE, fuel prices, fuel intake, and renewable fraction. The overall results indicate superior performance in the optimal system case, offering a feasible and suitable choice for the sustainable electrification of rural communities.