The news of the fall of Makkah created great surprise and disturbance among the surrounding tribes. Some of the tribes living around Makkah decided to join up and fight the Holy Prophet (S) together.

Meanwhile, the Holy Prophet (S) left Makkah after having stayed there for fifteen days. He appointed a guide to educate and instruct the people and entrusted the government and administration of the city, as well as the duty of leading prayers in the mosque, to a pious Muslim from Madinah.

The tribes who had gathered to fight the Muslims waited for them in the hills of Hunayn. The Holy Prophet (S), learning of their intentions, marched towards them riding at the head of a huge force of 12,000 Muslims.

The commander of the enemy army sent three spies into the Muslim army to find out their strength. The spies returned with their hearts full of fear at the power of the Muslims. On hearing their bad news, the enemy became demoralised. Their commander knew he was hopelessly outnumbered, so he decided to fight the Muslims by making a surprise attack when they crossed the mountain pass leading into Hunayn. This battle took place in 8 A.H.

When the Muslim army arrived at the narrow pass, they were forced to march in small groups. Moreover, they were overconfident because of their huge numbers, and this made them careless.

As soon as the Muslims entered the pass, the enemy attacked them from above with stones and arrows. Thereafter, a special group of skilled soldiers came down the mountain side and attacked the Muslims with their swords. The sudden attack broke up the Muslim ranks and they lost their courage. Many of them began to run away from the battle, despite the command of the Holy Prophet (S) to stay and fight.

The enemy made the Holy Prophet (S) their chief target, hoping to kill him and finish the war there and then. When Imam Ali (A) realised their intention, he stood next to the Holy Prophet (S) and the enemy could not overcome his skill at combat.

A famous warrior by the name of Abu Jundal came out to fight from the enemy side but unfortunately for him, he came up against Imam Ali (A) and soon lay dead. At this time Imam Ali (A) began to actively attack the enemy and struck terror into their hearts. By the time he stopped fighting, 40 enemy soldiers had been killed by him. The Muslims gained courage from this and returned to the battle.

The enemy could no longer contain the Muslims, who fell upon them from all sides. By the end of the war a further 30 enemy soldiers were killed.

On leaving the battlefield of Hunayn, some unbelievers gathered at Ootas to regroup and fight again. The Holy Prophet (S) sent a large force to deal with them. Eventually the Muslims won this battle, but not before their commander had been killed. They also took a large number of prisoners and war booty. The prisoners included the daughter of the foster mother of the Holy Prophet (S), Halimah Sa'dia. The Holy Prophet (S) received her with great honour and sent her back to her tribe under his own arrangements.

In the battles of Hunayn and Ootas, a large number of Muslims were killed in the initial confusion. Overall, it was a victory for the Muslims, because the enemy fled leaving behind 6,000 captives, 24,000 camels, 40,000 sheep and 4,000 Waqih of silver. (One Waqih equals 213 grams approximately.)

Allah has referred to this battle in the Holy Qur'an in the following words:

"Allah has helped you on many occasions including the day of Hunayn; when you were happy with the number of your men who proved to be of no help to you and the whole vast earth seemed to have no place to hide you (from your enemies), and you turned back in retreat." Surah at-Tawbah, 9:25

The Holy Prophet (S) ordered that the entire war booty be transferred to a place called Ja'rana until he returned from Ta'if.