The Jewish tribe of Banu Nadir, expelled from Madinah for treachery, sought revenge against the Muslims. They traveled to Makkah and successfully convinced the Quraysh to form an alliance against the Muslims.
The Quraysh, eager to reopen their trade routes and avenge previous defeats, readily agreed. To further strengthen their forces, the Banu Nadir promised the Ghatafan tribe half the produce of Khaybar for a year in exchange for their participation.
The alliance grew to include Quraysh, Ghatafan, Banu Asad, and other tribes, forming a powerful army of around 10,000 men, an unprecedented force against the Muslims.
When news of the approaching army reached Madinah, the Prophet ﷺ convened his companions to discuss a defense strategy. Salman al-Farsi رَضِيَ اللهُ عَنْهُ, drawing from his knowledge of Persian warfare, proposed digging a trench—a tactic unfamiliar to the Arabs—which the Prophet ﷺ approved. While the precise dimensions and location remain uncertain, modern estimates suggest the trench was approximately 2 km long, 10–13 feet wide, and 7–9 cubits deep, strategically positioned along the vulnerable northern side of Madinah.
The entire Muslim community participated in the excavation, including the Prophet ﷺ himself, demonstrating unity and resilience. He ﷺ encouraged his companions with supplications and poetry as they worked tirelessly.
One famous incident involved a large rock obstructing the digging. The Prophet ﷺ struck it three times, each time emitting sparks that he ﷺ declared as signs of future Muslim conquests in Syria, Persia, and Yemen, all of which came true during the Caliphate era.
To protect against potential betrayal from the Banu Qurayzah, the Prophet ﷺ relocated women and children to Al-Fari’, a fortress owned by Banu Haritha.
When two scouts from Banu Qurayzah attempted to infiltrate the fortress, Safiyyah bint Abdul Muttalib رَضِيَ اللهُ عَنْھَا, the Prophet’s ﷺ aunt, personally killed one of them and scared the other away, demonstrating remarkable courage.
The trench effectively prevented the 10,000-strong confederate army from entering Madinah. However, the Muslims faced severe hardship during the prolonged siege, enduring food shortages made worse by the cold of winter. They struggled with intense hunger, exhaustion, and the constant pressure of fear.
The Prophet ﷺ took charge of organizing defenses and patrolling the trench. Despite the difficulties, he ﷺ remained at the forefront, sharing in the hunger and exhaustion with his companions.
One remarkable incident involved Jabir رَضِيَ اللهُ عَنْهُ and his wife preparing a small meal, which, through the Prophet’s ﷺ blessing, miraculously fed a large number of companions.
Initially bound by a treaty with the Muslims, Banu Qurayzah succumbed to the influence of Huyayy ibn Akhtab, leader of Banu Nadir, and betrayed the Muslims. The Muslims discovered that Banu Qurayzah, had secretly conspired with the Quraysh and other tribes to attack Madinah. This added immense pressure, as the Muslims were now surrounded both externally and internally. This betrayal placed the Muslims in an even more vulnerable position, as they were already struggling to defend the trench against a massive enemy force.
While the trench prevented a full-scale attack, several intense skirmishes occurred. One of the most significant duels was between Ali ibn Abi Talib رَضِيَ اللهُ عَنْهُ and Amr ibn Abdu Wood, a feared warrior of the Quraysh. Ali رَضِيَ اللهُ عَنْهُ defeated Amr in one-on-one combat, demonstrating exceptional bravery and skill.
However, the siege also brought tragic losses. Sa’d ibn Mu’adh رَضِيَ اللهُ عَنْهُ, the chieftain of the Aws tribe, was fatally wounded when an arrow struck his upper arm near his neck. He succumbed to his injuries a few weeks later, marking a great loss for the Muslim community.
The battle also disrupted daily routines, including prayer. During one particularly intense engagement, the Muslims were unable to pray Salat al-Asr on time. Scholars debate whether Salat al-Khawf (the prayer during fear) had been revealed at that point, but the majority believe that due to the overwhelming situation, the Muslims genuinely forgot to pray Asr, as supported by various ahadith.
Amidst the chaos, Nu'aym ibn Mas'ud رَضِيَ اللهُ عَنْهُ, a member of the Ghatafan tribe, converted to Islam and secretly offered his help to the Prophet ﷺ. Given his strong ties with both Quraysh and Banu Qurayzah, the Prophet ﷺ allowed him to use his influence strategically.
Nu'aym رَضِيَ اللهُ عَنْهُ played both sides against each other:
He warned Banu Qurayzah that the Quraysh might abandon them and advised them to demand hostages as a guarantee.
He then told the Quraysh that Banu Qurayzah might betray them by handing over Quraysh leaders to the Muslims.
This created deep distrust between the allies, preventing a coordinated attack and buying the Muslims crucial time.
As tensions among the Confederate forces grew, a fierce storm struck their camp, extinguishing their fires, scattering their tents, and worsening their misery. The Quraysh, already doubting their allies, became demoralized.
Sensing their desperation, the Prophet ﷺ sent Hudhayfah ibn al-Yaman رَضِيَ اللهُ عَنْهُ on a dangerous intelligence mission. Braving the darkness and the howling wind, Hudhayfah رَضِيَ اللهُ عَنْهُ made his way to the Quraysh camp, moving quietly among them until he recognized Abu Sufyan by his posture. Though he had a clear shot, he remembered the Prophet’s ﷺ instruction to remain unseen and chose restraint. When Abu Sufyan ordered his men to verify those beside them to catch any spies, Hudhayfah رَضِيَ اللهُ عَنْهُ cleverly seized the moment—grasping the hands of those near him and demanding, “Who are you?”—thus confirming their identities without revealing his own. His calmness and sharp wit under such pressure reflected the strength granted by the Prophet’s ﷺ du‘a for him. From his hidden position, Hudhayfah رَضِيَ اللهُ عَنْهُ overheard Abu Sufyan announcing the Quraysh’s decision to retreat, successfully completing his mission.
The storm, combined with internal distrust and dwindling morale, forced Abu Sufyan to order a full retreat, marking the end of the siege. The Prophet ﷺ had prayed for victory, and Allah’s help arrived in the form of both natural and strategic intervention.
With the Confederate forces retreating, the Prophet ﷺ said, "Now we are going to launch an attack, and they are not going to ever launch an attack against us." The Battle of the Trench was a defining moment in Islamic history, demonstrating the faith, resilience, and strategic brilliance of the Muslims, along with divine support that ensured their survival and future success.