Sahih Muslim Book 5, Hadith Number 2309.

Chapter : The Khwarij and their characteristics.

Anas b. Malik reported: We conquered Mecca and then we went on an expedition to Hunain. The polytheists came, forming themselves into the best rows that I have seen. They first formed the rows of cavalry, then those of infantry, and then those of women behind them. Then there were formed the rows of sheep and goats and then of other animals. We were also people large in number, and our (number) had reached six thousand. And on one side Khalid b. Walid was in charge of the cavalry. And our horses at once turned back from our rear. And we could hardly hold our own when our horses were exposed, and the bedouins and the people whom we knew took to their heels. (Seeing this) the Messenger of Allah (may peace be upon him) called thus: O refugees, O refugees. He then, said: O Ansar, O Ansar. (Anas said: This Hadith is transmitted by a group of eminent persons.) We said: At thy beck and call are we, Messenger of Allah. The Messenger of Allah (may peace be upon him) then advanced and he (Anas) said: By Allah, we had not yet reached them when Allah defeated them and we took possession of the wealth and we then marched towards Ta’if, and we besieged them for forty nights and then came back to Mecca and encamped (at a place), and the Messenger of Allah (may peace be upon him) began to bestow a hundred camels upon each individual. The rest of the Hadith is the same.