The Battle of Khandaq, also known as the Battle of the Trench, Ghazwa Khandaq or Battle of the Ditch, marks one of the most pivotal moments in early Islamic history. Taking place in 627 CE (5 AH) in Madinah, this strategic confrontation between the Muslim community and a vast confederate army was not just a military encounter—it was a profound story of resilience, faith, and tactical brilliance.
Today, visitors to Madinah can explore the area where this historic battle unfolded, especially with convenient access through the Madinah Hop-On Hop-Off Bus, which includes the battle site among its key heritage stops.
Origins of the Conflict
Following the expulsion of the Banu Nadir tribe from Madinah, its exiled leaders, fueled by a desire for vengeance, approached the Quraysh of Mecca and other tribes to unite against the Muslims. This led to the formation of an unprecedented coalition of over 10,000 warriors, known in Islamic history as Ahzab (the Confederates).
Their objective was clear: to crush the Muslim presence in Madinah and eliminate Prophet Muhammad (ﷺ) and his followers once and for all.
The Strategic Turning Point: Digging the Trench
Realizing the overwhelming odds, the Prophet Muhammad (ﷺ) held a consultation with his companions. It was during this council that Salman Al-Farsi (the Persian), who had experience with Persian warfare, proposed a novel idea never before seen in Arabian battles: digging a trench on the vulnerable northern side of Madinah.
This would act as a formidable barrier, especially against cavalry, effectively turning geography into defense.

How Big Was the Trench in Madinah?
- Length: Approximately 5.5 km
- Width: About 9 meters
- Depth: Around 4.5 meters
This massive task was completed in just six days, with the Prophet himself participating in the digging.

Today, portions of the original trench zone can still be visited, especially along Sila’ Mountain and the Khandaq area, accessible via the Madinah Hop-On Hop-Off Bus route—making it easy for visitors to immerse themselves in this historical setting.
Who Fought in the Battle of Khandaq?
The Muslim defense force numbered around 3,000, facing a confederate army of 10,000. Key companions like:
- Ali ibn Abi Talib
- Sa’d ibn Muadh
- Salman Al-Farsi
- Zubair ibn Al-Awwam
stood alongside the Prophet in the face of immense pressure. On the opposing side were figures such as:
- Abu Sufyan (leader of Quraysh)
- Amr ibn Abd Wudd (a famed warrior)
The Siege: 30 Days of Endurance
The Confederates laid siege to Madinah for about a month, hoping to break the Muslim spirit. However, the trench served its purpose well—enemy horses could not cross, and surprise attacks were neutralized.
Key Events During the Siege:
- Quraysh’s repeated attempts to cross the trench failed.
- Harsh weather and diminishing supplies demoralized the confederates.
- The Banu Qurayza, a Jewish tribe in Madinah, violated their pact with the Muslims by secretly conspiring with the enemy.
Despite this betrayal, the Muslims held firm, defending their city under extreme conditions. When the weather turned, and unity among the confederates crumbled, the enemy retreated in failure—marking a crucial Muslim victory.
Who Won the Battle of Khandaq?
The Muslims emerged victorious, not through brute force but via strategy, unity, and divine support. The battle ended without a full-scale clash but with a failed siege by the enemy.
It was a psychological and strategic win that shifted the power dynamic in the Arabian Peninsula, strengthening the Muslim position in Madinah and paving the way for future peace treaties like Hudaybiyyah.
Who Fought With Hazrat Ali in Khandaq?
During the Battle of the Ditch, when the Quraysh warrior Amr ibn Abd Wudd crossed the trench and challenged the Muslims to single combat, Ali ibn Abi Talib bravely stepped forward. Despite Amr’s fearsome reputation, Ali engaged him in a fierce duel and ultimately defeated him, delivering a major blow to enemy morale and reinforcing the courage and faith of the Muslim defenders. The confrontation took place in full view of both armies, heightening its impact.
After Ali’s victory, Amr’s body was left where it fell, and no other warrior dared to cross the trench again.
What Happened to the Banu Qurayza?
After the confederate retreat, the Muslims addressed the treachery of Banu Qurayza, who had violated a peace treaty by allying with the enemy. After a siege and surrender, their fate was judged by Sa’d ibn Muadh, a former ally of the tribe, whose ruling was based on their own legal tradition.
This difficult chapter in the aftermath of Khandaq highlights the complexities of war and justice during that era.
Where Is the Battle of Khandaq Site Today?
The site of the Battle of Khandaq is located in northern Madinah, near Jabal Sila’ (Mount Sila’). It is surrounded by a group of historic mosques known as the Seven Mosques, which commemorate key moments and figures from the battle.
Notable Sites to Visit:
Masjid Al-Fath
The largest and most prominent of the Seven Mosques, Masjid Al-Fath is believed to be built on the site where the Prophet Muhammad (ﷺ) prayed during the siege. Its name, “Al-Fath” (The Victory), symbolizes the Muslim triumph in the Battle of the Ditch. The mosque sits on a slope of Jabal Sila’ and offers a panoramic view of the surrounding battlefield.

Masjid Salman Al-Farsi
Named after Salman Al-Farsi, the companion who proposed the trench strategy, this mosque honors his crucial contribution to the battle’s outcome. It stands as a tribute to his insight and the role he played in protecting Madinah. Visitors often reflect here on the importance of wisdom and unity in facing adversity.

Jabal Sila (Mount Sila)
Though not a mosque, Jabal Sila is a low mountain ridge that served as a defensive high ground during the battle. Many of the trenches were dug nearby, and today the mountain offers visitors a chance to physically connect with the geography of the battle. Several of the Seven Mosques, including Masjid Al-Fath, are built along its base.
Legacy of Ghazwa Khandaq
Strategic Wisdom
The trench strategy redefined Arabian warfare. It taught that brains can overpower brawn, and planning could prevent bloodshed.
Faith in Action
The Prophet (ﷺ) and his companions endured hunger, fear, and betrayal—yet remained unshaken. This battle is remembered for its spiritual depth and reliance on divine support, as captured in the Qur’an (Surah Al-Ahzab).
“When they came at you from above you and from below you, and when eyes swerved and hearts reached the throats...”
— Qur’an 33:10
A Symbol of Unity
Despite facing odds three times their number, the Muslims stood united—a key factor in their victory.
Visiting the Battle of Khandaq Today
For travelers and pilgrims in Madinah, visiting the Battle of Khandaq site is a must-do spiritual and historical experience. Whether you're tracing the Prophet's footsteps or simply soaking in the atmosphere of this legendary battle, the area offers a deep connection to the legacy of early Islam.
To enhance your journey, hop aboard the Madinah Hop-On Hop-Off Bus, which stops near key landmarks like Masjid Al-Fath and the trench zone—making your historical exploration both easy and enriching.
Conclusion
The Battle of Khandaq wasn’t just a standoff; it was a turning point in Islamic history. Through tactical brilliance, unshakable faith, and unified resolve, the Muslims defended Madinah against overwhelming odds. Its legacy endures not just in books, but in the very landscape of Madinah, where visitors can still feel the echoes of resilience.
Next time you're in Madinah, don’t miss the chance to step back in time—especially with the Madinah Hop-On Hop-Off Bus as your guide through one of Islam’s most defining chapters.
May your visit to this blessed city inspire faith, strength, and a deeper appreciation of its timeless legacy.