Shawwal, 5 AH (March 627 CE) major

Battle of the Trench (Khandaq)

غزوة الخندق

Northern Medina

# The Battle of the Trench (al-Khandaq)

The Confederate Alliance

The Battle of the Trench — al-Khandaq (The Ditch) or al-Ahzab (The Confederates) — was fought in Shawwal 5 AH. It represented the most dangerous military challenge the Muslim community had faced since the Hijra: a confederation of approximately 10,000 warriors assembled from the Quraysh of Mecca, the Ghatafan tribes of the Najd, and several allied groups, all marching on Medina together. The confederation had been organized largely through the efforts of Banu al-Nadir — the Jewish tribe expelled from Medina the previous year — whose leaders had traveled to Mecca and the tribes of the Najd, rallied support, and created the largest hostile force yet directed against the Muslim community.

The scale was unprecedented. The Muslims of Medina numbered approximately 3,000 fighters — outnumbered more than three to one. An open battle was impossible. Defense from within the city was standard but the southern approaches to Medina were open enough that a large cavalry force could threaten the city directly.

Salman al-Farisi and the Trench

The tactical solution came from Salman al-Farisi — the Persian companion who had traveled from Persia to Arabia seeking the final prophet. He had participated in Persian military campaigns and knew a tactic unknown in Arabian warfare: the defensive trench. He suggested digging a wide, deep ditch across the northern approach to Medina — the direction from which the confederate army would come. The proposal was accepted. The Prophet ﷺ divided the companions into sections, each responsible for a portion of the trench. Approximately 3,000 men dug for several days, with the Prophet ﷺ working alongside them, carrying dirt and stone.

The miracle of the rock — narrated in detail in Sahih al-Bukhari — occurred during the digging: the workers encountered a large rock that could not be broken. The Prophet ﷺ took the pickaxe himself and struck it three times; each strike produced a large spark. He described each spark as revealing, in prophetic vision, the conquests to come: the palaces of the Persian Kisra in the first strike, the palaces of Caesar in the second, and the palaces of Yemen in the third. The companions working alongside him were hungry and weak — the narrations describe them tying stones to their abdomens against hunger, and the Prophet ﷺ doing the same. When food was brought — by Jabir ibn Abdullah's wife, a small meal intended for the Prophet ﷺ alone — the Prophet ﷺ called all the companions to eat from it, and the narrations record that approximately a thousand men ate from what had been prepared for a few, and the food remained.

The Siege

The confederate army arrived and found the trench blocking their advance. Arabian cavalry did not cross trenches; the tactic, as Salman had expected, completely nullified the numerical and cavalry advantage of the attacking force. The siege lasted approximately twenty-five days. Several Qurayshi horsemen attempted to cross the narrow sections of the trench; most were repelled. Amr ibn Abd Wadd — one of the most celebrated warriors of Arabia, said to be worth a thousand fighters — managed to cross with a small group and was killed in single combat by Ali ibn Abi Talib.

The greatest threat to the Muslim position came from within: Banu Qurayza, the third Jewish tribe of Medina and the last still in the city, broke their covenant and began negotiating with the confederates. This threatened to open Medina to attack from the south while the confederate army pressed from the north. The Muslim community faced potential encirclement.

The Wind and the Withdrawal

The siege ended not through battle but through divine intervention and political dissolution. Allah sent a fierce wind and freezing cold against the confederate camp that toppled their tents, extinguished their fires, and made their position untenable. Simultaneously, Nu'aym ibn Mas'ud — a member of the Ghatafan tribe who had secretly converted to Islam — sowed mutual distrust between the confederate coalition partners. The confederates, who had never achieved a decisive breakthrough, began to suspect each other of preparing to abandon the alliance. Abu Sufyan ordered the withdrawal. The coalition dissolved.

Surah al-Ahzab (33:9-27) is the Quranic account of these events, including the famous verse (33:10): "When they came upon you from above you and from below you, and when eyes shifted and hearts reached the throats and you assumed about Allah various assumptions" — a description of the terror that gripped the Muslim community during the siege. The surah concludes with the aftermath: the siege had ended, but the covenant breach of Banu Qurayza remained to be addressed.

The Strategic Significance

The Battle of the Trench was the last major attempt by the Quraysh of Mecca — at the height of their power and in coalition with the largest confederation ever assembled against Medina — to destroy the Muslim community. Its failure was decisive. The confederate army had been assembled at great political cost; when it withdrew without achieving anything, the coalition dissolved permanently. Abu Sufyan would later acknowledge that after al-Ahzab, the Quraysh could not assemble a force of that scale again.

The trench tactic — brought to Arabia by Salman al-Farisi — changed the nature of Arabian warfare and demonstrated the Prophet's ﷺ strategic flexibility: the willingness to adopt effective methods from other civilizations rather than restricting the community to familiar techniques. Salman's contribution to the defense of Medina was itself symbolic of the Muslim community's identity — a Persian who had sought the final prophet from half a world away was now defending his adopted city with knowledge from his homeland, and his idea saved thousands of Muslim lives. The Prophet ﷺ said of Salman: "Salman is one of us, the People of the House" — the highest honor he could give to a companion, placing him among the Ahl al-Bayt. The trench he suggested has given the battle its name for fourteen centuries.

Sources: Sahih al-Bukhari (Kitab al-Maghazi); Sahih Muslim (Kitab al-Jihad); Ibn Hisham, al-Sira al-Nabawiyya; Ibn Kathir, al-Bidayah wan-Nihayah; Ibn Sa'd, al-Tabaqat al-Kubra; Surah al-Ahzab (33:9-27)

Sources

  • Sahih al-Bukhari, Kitab al-Maghazi
  • Sahih Muslim, Kitab al-Jihad
  • Ibn Hisham, al-Sira al-Nabawiyya
  • Ibn Kathir, al-Bidayah wan-Nihayah
  • Surah al-Ahzab (33:9-27)