LoginSign up
TodayArticlesBattlesBiographiesStory mode

maart 627 · Shawwal–Dhul Qa'dah, 5 AH

The Battle of the Trench

غزوة الخندق

Siera van de Profeet ﷺ · De Medina Periode

In Shawwal of the fifth year after the Hijrah (627 CE), a coalition of around 10,000 men, Quraysh, Ghatafan and their allies, besieged the city of Madinah. On the advice of Salman al-Farisi ﵁, the Muslims dug a trench along the unprotected northern flank. After 27 days of siege, the betrayal of the Banu Qurayza, and the legendary duel of Ali ﵁ against Amr ibn Abd Wudd, the coalition fell apart through divine intervention: a devastating wind and the stratagem of Nu'aym ibn Mas'ud ﵁.

Open the interactive battle map
Phase 1

The Coalition Forms

After the banishment of the Banu Nadir from Madinah in the fourth year after the Hijrah, their leader Huyayy ibn Akhtab travelled to Makkah with one purpose: to persuade the Quraysh to launch a final assault on Madinah. He promised Abu Sufyan that the Jewish tribes in Madinah would cooperate from within. Abu Sufyan agreed. The Quraysh mobilised 4,000 infantry and 300 horsemen under his command.

Huyayy then went to the Ghatafan tribes in Najd. Uyayna ibn Hisn, leader of the Banu Fazara, and al-Harith ibn ‘Awf of the Banu Murra were persuaded with the promise of half of the date harvest of Khaybar. The Ghatafan supplied 4,000 fighters. In addition, the Banu Sulaym joined with 700 men, the Banu Ashja’ with 400, and various smaller tribes with another 600 or so, for a coalition of around 10,000 men in total.

It was the largest army ever assembled against the Muslims. The Arab world seemed to be uniting to destroy the community of the Prophet ﷺ once and for all. From Makkah the Quraysh marched northward, while the Ghatafan advanced from the east; two enormous armies that would meet at Madinah.

“When they came at you from above you and from below you, and when eyes shifted and hearts reached the throats”

Surah al-Ahzab (33:10)

Phase 2

The Trench

When the news of the approaching coalition reached Madinah, the Prophet ﷺ called his Companions together for consultation (shura). The Muslims were hopelessly outnumbered: only about 3,000 men against an enemy more than three times as strong. An open battle would be suicide.

Then Salman al-Farisi ﵁ stood up, the Persian Companion who had known both the Byzantine and the Sassanid empires. He proposed a tactic the Arabs had never seen before: “O Messenger of Allah, when we were besieged in Persia, we dug a trench around our city.” The Prophet ﷺ embraced the idea immediately and said to Salman: “You are one of us, O people of the household.”

The Muslims began digging at once. For six days they worked unceasingly on a trench of about 5.5 kilometres along the unprotected northern approach to Madinah. The southern, eastern and western flanks were protected by lava fields (harra) and dense palm groves that were impassable to cavalry. The Prophet ﷺ himself dug alongside them, carried earth and encouraged his Companions with song.

While digging, they came upon an enormous rock that no pickaxe could break. The Prophet ﷺ struck it three times with the pick, and with each blow a spark flew: the first lit up Syria: “Allah is the Greatest! The keys of Syria have been given to me”; the second lit up Persia: “The keys of Persia have been given to me”; and the third lit up Yemen: “The keys of Yemen have been given to me.” The hypocrites laughed at these prophecies, while the Muslims dug deeper.

The hunger was unbearable. The Companions tied stones against their bellies to ease the pain. When Jabir ibn 'Abdullah ﵁ saw that the Prophet ﷺ had two stones tied against his belly, he secretly slaughtered a sheep and invited the Prophet ﷺ to a meal, from which the entire army miraculously ate.

Phase 3

The Siege

When the coalition arrived from the north and saw the trench, they were astounded. Never before had such a defence been used in Arab warfare. Abu Sufyan exclaimed: “This is a stratagem the Arabs do not know!” The army could not cross the wide, deep trench with cavalry or infantry, exactly as Salman ﵁ had foreseen.

The Quraysh pitched their camp to the northwest of the trench, on the plain of Ruma. The Ghatafan took up positions to the northeast. Together they encircled the northern approach to Madinah, but could not break through. The Muslims drew up behind the trench, alert day and night.

For 27 days the siege lasted. Each day groups of horsemen, including Khalid ibn al-Walid and 'Ikrima ibn Abi Jahl, tried to find narrow points in the trench to cross over; each time they were driven back by archers and stone-throwers. The bitter cold of the Madinah winter tormented both camps. Food grew scarce; the Muslims fasted involuntarily while the Quraysh saw their supplies dwindle.

Frustration grew. Abu Sufyan had counted on a swift battle and a decisive victory. Instead, he stood powerless before a ditch, staring at an enemy he could not reach.

Phase 4

The Betrayal of Banu Qurayza

While the Muslims held firm behind the trench, Huyayy ibn Akhtab, the man who had organised the entire coalition, slipped to the fortress of the Banu Qurayza on the southeastern side of Madinah. His aim: to break the treaty between the Banu Qurayza and the Prophet ﷺ, so that the Muslims would be attacked from two sides.

Ka’b ibn Asad, the chief of the Banu Qurayza, initially refused. “Muhammad has always honoured his treaties with us,” he said, and refused even to let Huyayy in. But Huyayy persisted. He promised Ka’b that if the coalition failed, he would enter the fortress himself and share the fate of the Qurayza. In the end Ka’b gave in. The treaty with the Prophet ﷺ was torn up.

When rumours of the betrayal reached the Prophet ﷺ, he sent Sa’d ibn Mu’adh ﵁ (leader of the Aws) and Sa’d ibn 'Ubada ﵁ (leader of the Khazraj) to verify the situation. They returned with grim news and used the codeword “'Adal and Qarah”, a reference to an earlier betrayal, to warn the Prophet ﷺ without sowing panic among the troops.

The situation suddenly became desperate. The trench protected the northern side, but the Banu Qurayza sat on the unprotected southeastern side, directly opposite the fortress of the Banu Harithah where the women and children of the Muslims had been sheltered. The Muslims now faced a two-front war: ten thousand enemies before the trench and traitors behind them.

The Prophet ﷺ immediately sent detachments to guard the southeastern approach. Safiyya bint 'Abd al-Muttalib ﵂, the aunt of the Prophet ﷺ, was in the fortress of the Banu Harithah when an enemy scout approached the fortress. She seized a stake and killed him, the first woman in Islam to kill an enemy in defence.

“And when the hypocrites and those in whose hearts is a disease said: ‘Allah and His Messenger have promised us nothing but delusion’”

Surah al-Ahzab (33:12)

Phase 5

The Duel of Ali and Amr

One day a small group of Quraysh fighters managed to cross the trench at a narrow point. Among them was 'Amr ibn 'Abd Wudd, a legendary warrior reckoned “equal to a thousand men” and who had been unable to take part at the Battle of Badr because of injuries. Now, at the Trench, he loudly demanded a single combat.

His challenge rang out across the battlefield: “Is there anyone who will come out to fight?” Silence fell over the Muslim ranks. The Companions knew the reputation of 'Amr; even the bravest hesitated. Then 'Ali ibn Abi Talib ﵁ rose and offered himself. The Prophet ﷺ held him back. 'Amr called out again. 'Ali ﵁ rose again. The Prophet ﷺ held him back again. At the third challenge the Prophet ﷺ gave him permission, embraced him and said: “O Allah, protect him.”

'Ali ﵁ stepped forward and offered 'Amr three choices: accept Islam, withdraw, or fight. 'Amr laughed scornfully and chose the sword. The duel was fierce but short. 'Amr struck with his sword and hit 'Ali’s shield, but 'Ali ﵁ found an opening and delivered the decisive blow. Dust swirled up; when it settled, 'Ali ﵁ stood as the victor.

The Prophet ﷺ said: “The blow of 'Ali on the day of al-Khandaq is better than the worship of mankind and the jinn.” The remaining Quraysh fighters who had crossed the trench fled back; one of them fell into the trench and was killed. The morale of the coalition was broken by the loss of their mightiest champion.

Phase 6

The Divine Aid

While the siege continued, an unexpected ally presented himself. Nu’aym ibn Mas’ud ﵁, a leader of the Ghatafan, had secretly accepted Islam, a fact known neither to the Quraysh, the Ghatafan, nor the Banu Qurayza. He came to the Prophet ﷺ and offered his services. The Prophet ﷺ answered: “War is deception”, and gave him permission to sow division.

Nu’aym ﵁ went first to the Banu Qurayza, with whom he had an old bond of friendship. He warned them: “The Quraysh and Ghatafan will leave when it suits them, and you will be left alone with Muhammad. Demand hostages from the Quraysh as a guarantee that they will not leave.” He then went to Abu Sufyan and said: “The Banu Qurayza regret their betrayal. They will demand hostages from you to hand over to Muhammad.” Finally he told the same to the Ghatafan.

When Abu Sufyan demanded hostages from the Qurayza and the Qurayza demanded hostages from the Quraysh, each camp confirmed exactly what Nu’aym ﵁ had said. The mutual mistrust paralysed the coalition. The three parties refused to cooperate any longer.

Then came the divine aid. On a bitter night, Allah ﷻ sent a tremendous east wind that wrecked the camps of the coalition. Tents were blown away, cooking fires extinguished, ropes torn loose. The cold and darkness made the situation untenable.

The Prophet ﷺ sent Hudhayfa ibn al-Yaman ﵁ as a scout to the enemy camp. Hudhayfa ﵁ found chaos: men trying in vain to keep their tents upright, horses breaking loose, weapons lying in the mud. Abu Sufyan stood up and called out: “Let everyone look at his neighbour!”, to check that there were no spies. Then he gave the order: the Quraysh leave. This very night.

In the darkness of the night, the largest army ever assembled against the Muslims broke camp and departed. The Ghatafan followed shortly after.

“O you who believe, remember the favour of Allah upon you, when armies came at you and We sent against them a wind and armies you did not see”

Surah al-Ahzab (33:9)

“And Allah turned back the disbelievers in their rage, having gained no good”

Surah al-Ahzab (33:25)

Phase 7

The Aftermath

Even before the Muslims had laid down their weapons, Jibril ﵇ came to the Prophet ﷺ with the words: “Have you laid down your weapons? The angels have not yet laid down theirs.” He pointed in the direction of the Banu Qurayza.

The Prophet ﷺ immediately gave the order: “No one prays the afternoon prayer except at the Banu Qurayza.” The Muslims marched directly from the trench to the fortresses of the Qurayza in the southeast of Madinah.

The siege of the Banu Qurayza lasted 25 days. Hemmed in within their forts, without the help of the coalition that had departed, and aware that their betrayal had taken place at the most critical moment of the war, the Banu Qurayza eventually surrendered. They asked that Sa’d ibn Mu’adh ﵁, their former ally as leader of the Aws, should judge over them, in the hope of leniency on account of the old alliance.

Sa’d ﵁ was carried in on a stretcher; he was severely wounded by an arrow in his arm that he had taken during the siege of the trench. Despite his wounds he pronounced his judgment, according to the law of the Torah for treachery in time of war. The men who had fought were sentenced to death; the women and children were taken captive.

Sa’d ibn Mu’adh ﵁ died shortly afterward of his wounds. The Prophet ﷺ said of him: “The Throne of the Most Merciful trembled at the death of Sa’d ibn Mu’adh.”

The Battle of the Trench was a strategic turning point. Never again would Makkah be able to launch an offensive against Madinah. The Prophet ﷺ spoke the prophetic words: “Now we shall march against them, and they no more against us.” The initiative had shifted definitively from the Quraysh to the Muslims. The road to the conquest of Makkah had been opened.

The Battle of the Trench — Map

This battle can be followed phase by phase on the interactive 3D map, from the opening moves to the final outcome. The map covers the following phases:

  • Phase 1:The Coalition Forms
  • Phase 2:The Trench
  • Phase 3:The Siege
  • Phase 4:The Betrayal of Banu Qurayza
  • Phase 5:The Duel of Ali and Amr
  • Phase 6:The Divine Aid
  • Phase 7:The Aftermath
Open the interactive battle map

Frequently asked questions

Who suggested digging the trench at the Battle of the Trench?

The trench at the Battle of the Trench (5 AH, 627 CE) was proposed by Salman al-Farisi ﵁, the Persian Companion of the Prophet ﷺ, who during the consultation about the approaching coalition suggested a tactic the Arabs had never seen: in Persia, a besieged city would be defended by digging a trench around it. The Prophet ﷺ embraced the idea immediately and told Salman ﵁ that he was one of the people of the household. The roughly 3,000 Muslims then dug the trench along the unprotected northern approach to Madinah.

How long and how deep was the trench at the Battle of the Trench?

The classical sources do not agree on the exact dimensions of the trench at Madinah: estimates of its length range from about 5.5 to 10 kilometres and estimates of its depth from roughly 3.2 to 5 metres, so any single figure remains an approximation. The early historians described the trench generations later and left no measurements. What is certain is that it sealed off the unprotected northern approach to Madinah and was too wide and too deep for cavalry or infantry to cross, exactly as Salman al-Farisi ﵁ had foreseen.

How long did it take to dig the trench?

According to several accounts, digging the trench at Madinah took about six days, during which the roughly 3,000 Muslims worked unceasingly on the defensive line along the northern approach to the city, while the remaining flanks were protected by lava fields and dense palm groves. The Prophet ﷺ dug alongside his Companions, carried earth and encouraged them with song. Hunger was so severe that the Companions tied stones against their bellies to ease the pain.

Why is the Battle of the Trench also called the Battle of al-Ahzab?

The Battle of the Trench is also called the Battle of al-Ahzab, the Battle of the Confederates, because the attackers formed not one single army but a coalition of around 10,000 men drawn from the Quraysh, the Ghatafan, the Banu Sulaym and various smaller tribes, united to destroy Madinah. It was the largest army ever assembled against the Muslims. In the Qur'an, Surah al-Ahzab refers to this siege, including the verse about the wind sent against the armies (33:9).

How did the Battle of the Trench end?

The Battle of the Trench ended after a siege of 27 days when Allah ﷻ sent a tremendous east wind on a bitter night that wrecked the camps of the coalition, after the stratagem of Nu'aym ibn Mas'ud ﵁ had already broken the mutual trust between the Quraysh, the Ghatafan and the Banu Qurayza. That same night Abu Sufyan gave the order to depart, and the largest army ever assembled against the Muslims broke camp without having fought a decisive battle.

When did the Battle of the Trench take place?

The Battle of the Trench took place in Shawwal and Dhul Qa'dah of the fifth year after the Hijrah, in March 627 CE, when a coalition of around 10,000 men besieged the city of Madinah and its roughly 3,000 defenders held out behind the trench for 27 days. The bitter cold of the Madinah winter tormented both camps during those weeks, and food grew scarce on both sides.

Who won the Battle of the Trench?

The Muslims won the Battle of the Trench (5 AH, 627 CE): the coalition of around 10,000 men failed in 27 days to break through the trench and finally withdrew in the night, while Madinah remained unharmed and its roughly 3,000 defenders held their ground. The battle marked a strategic turning point, for Makkah would never again launch an offensive against Madinah. The Prophet ﷺ declared that from then on the Muslims would march against them, and they no more against the Muslims.