At this time the tribes of Hawazin and Thakif showed unwillingness to render obedience to the Muslims without resistance. They formed a league with the intention of attacking the Prophet, but he was vigilant enough to frustrate their plan. A big battle was fought with this new enemy of Islam near Hunain, a deep and narrow defile nine miles northeast of Mecca. The idolaters were utterly defeated. One body of the enemy, consisting chiefly of the Thakif tribe, took refuge in their fortified city of Ta'if, which eight or nine years before had dismissed the Prophet from within its walls with injuries and insults. The remainder of the defeated force, consisting principally of the Hawazin, sought refuge at a camp in the valley of Autas. This camp was raided by the Muslim troops. The families of the Hawazin, their flocks and herds with all their other effects, were captured by the troops of the Prophet. Ta'if was then besieged for a few days only, after which the Prophet raised the siege, well knowing that the people of Ta'if would soon be forced by circumstances to submit without bloodshed.
Returning to his camp where the prisoners of Hawazin were left safely, the Prophet found a deputation from this hostile tribe who begged him to set free their families. The Prophet replied that he was willing to give back his own share of the captives and that of the children of Abdul Muttalib, but that he could not force his followers to abandon the fruits of their victory. The disciples followed the generous example of their teacher. The hearts of several members of the Thakif tribe were so influenced by this that they offered their allegiance and soon became earnest Muslims. The Prophet now returned to Medina fully satisfied with the achievements of his mission.