God put a prophecy to Muslims in the Quran about the war of confederates that will happen. read the verse:
38:11 But there - will be put to flight even a host of confederates. جُندٌ مَّا هُنَالِكَ مَهْزُومٌ مِّنَ الْأَحْزَابِ
In this battle the Arab tribes gathered in about 10,000 man to fight the few hundrad Muslims who fled Mecca because of oppression and torture. Many Muslims were nervous since if they would get to them they likely to slaughter them in the town of Median. One of the Muslims got a vision from God to dig in the ground to make a barrier along the border of the town. Prophets Muhammd (PBUH) and the Muslims did the large dig. The tribes surrounded them however with the large dig and the strong wind God sent caused the tribes to gather themselves and to flee or made to flight by God. Muslims acknowledge that God had alone won for them this battle.