As for the group that you could not possibly defeat, God took care of them; God is Omnipotent.
وَأُخرىٰ لَم تَقدِروا عَلَيها قَد أَحاطَ اللَّهُ بِها وَكانَ اللَّهُ عَلىٰ كُلِّ شَىءٍ قَديرًا
wa ukhraa lam taqdiroo ‘alaihaa qad ahaatal laahu bihaa; wa kaanal laahu ‘alaa kulli shai’in qadeera