After the conquest of Mecca, the Muslims stayed in the city for two weeks when a news soon broke out that a big army had been mobilized in the valley of Hunain to attack Mecca and to undo the victory of the Muslims. This time Muhammad assembled a force of twelve thousand warriors, which included two thousand non-Muslim Meccans. Muhammad was forced to make necessary preparations for defence. He felt the necessity of borrowing money for provisions and war supplies, therefore, according to "Masnad" (Cairo, 1895, 4th vol., p. 36) by Ahmad bin Hanbal (d. 241/855), "He took a loan of 30,000 dhirams from Abdullah bin Rabiah, a step-brother of Abu Jahl, who was very rich." He also wanted from Safwan bin Umayyah, who had not yet accepted Islam, to lend him the weapons of war. Safwan offered one hundred coats of mail together with their accessories. On 6th Shawal, 8/January 27, 630, Muhammad marched to Hunain to crush the powers of the four savage tribes, viz. Thaqif, Hawazin, Sa'd and Jasam. In order to reach the fertile valley of Taif, they had to pass through a narrow defile, called Hunain. It is a name of a valley running from Shara'il-ul-Mujahid, which is 11 miles east-north-east of Mecca, to Shara'i Nakhlah which is 7 miles and then runs north towards Zeima. Between the Shara'i the valley is quite wide, about 2 miles in most places, but beyond the old Shara'i it narrows down to between a quarter and a half-mile, and as it approaches Zeima, it gets narrower still. It is this second portion of the Hunain valley which is a defile, and the defile is narrowest near Zeima. Beyond Zeima the Taif route winds into the Wadi Nakhlat-ul-Yamaniyya.
When the Muslim army entered the narrow defiles overlooking the valley, Hawazin sharp-shooters, securely hidden; sent forth a murderous rain of arrows, causing havoc among the Muslims ranks, who took to a wild flight, and only a handful were left with Muhammad. At this critical moment, writes Ibn Hisham (2nd vol., p. 444), Muhammad raised his voice in a great cry, "O Muslims! I am here! I am the Prophet of God, and no one dare doubt my word. I am Muhammad, the son of Abdul Muttalib." But his cries were of no avail. The leading elements of Hawazin got to the place where Muhammad stood, and here Ali brought down the first infidel to fall at Hunain - a man mounted on a red camel, carrying a long lance at the end of which flew a black pennant. This man was chasing the Muslims as they fled. Ali pursued the man, and cut the tendons of the camel's hind legs with his sword. The man fell with the camel. Muhammad now moved towards the right with his handful companions and took shelter on a rocky spur. He turned to Ibn Abbas and ordered him to call the Muslims to rally around him. Ibn Abbas was of large stature who had very resonant voice, which according to some accounts, could be heard long away. He shouted: "O'people of Ansars! O'people of the Tree (those who had taken oath of allegiance at Hudaibia)" No sooner did this inspiring call reach the ears of the retreating Muslims than they rallied again, and made a counter-attack. The tide turned at once, and the unbelievers took to flight and dispersed.
It must be known that the Muslims had counter-attacked with such reckless courage that the enemy's ranks were broken and their forces split into two. One half fled widely from the field and retreated to their homes, the other half took refuge in their fortress of Taif. Thus, the Muslims pursued the fleeing enemy to the city wall of the fortified Taif, about 75 miles from Mecca by the old route, and laid siege to the city which lasted for a month or so. It is reported that the Muslims had used for the first time the advanced siege appliances of the day, such as the dababah (a wheeled structure made of brick and stone to provide a constant cover to besiegers) and the minjaniq (ballista, a wooden structure to hurl large stones to break through fortifications) newly acquired from the Jews of Khaibar. They caused considerable loss of life to the besiegers by the advanced defensive unit of shooting arrows with fire balls of bitumen as warheads against the wooden ballista. Later, Muhammad raised the siege on the advice of a wise Bedouin. Meanwhile, the defeated Hawazin sent six of their chiefs to seek peace and beg for mercy, which was accepted. This is called the battle of Hunain, in which the enemies lost seventy of their bravest. Six thousand captives including women and children, forty thousand sheeps and goats, four thousand ounces of silver and twenty four thousand camels formed the booty of Hunain.
Returning from Taif, Muhammad halted at Je'raanah, a place beyond the outskirts of Mecca, where the entire booty of Hunain had been collected for distribution. In the division of the spoils, a large proportion fell to the share of the newly converted Meccans than to the people of Medina. Some of the Medinite Ansars looked upon this as an act of partiality and thus, there were whispers of dissatisfaction. Some of them said: "The Prophet had rewarded the Meccans and deprived us of our share, although the blood of the Meccans is still dripping from our swords." Other said: "We are remembered in moments of difficulties while booty is given to others." When their discontent reached the ear of Muhammad, he assembled the disheartened Medinite Ansars together and spoke, "O' men of Ansar, is it not true that you were in the dark and through me God guided you towards light?" The Ansar replied, "Verily, God and His Prophet did us a great favour." Then he said, "Were you not torn by enmities and hostilities among yourselves and did I not give you unity and peace?" They said, "Verily, we are indebted to you for many favours." Then he said, "Were you not poor and God through me made you rich?" They said, "Verily, God and His Prophet have been kind to us." Then he said, "O' men of Ansar, why you disturb your hearts because of the things of this life? Would you not prefer that the other people return to their homes with the goats and camels, while you go back to your homes with me in your midst?" On hearing his words, the Ansar wept and said that they wanted only Muhammad and nothing else.