The Battle of the Trench — also known as the Battle of Khandaq, Ghazwa Khandaq, or the Battle of the Ditch — is one of the most defining moments in early Islamic history. It took place in 627 CE (5 AH) in Madinah, when the city was besieged by a coalition of tribes opposed to the growing influence of Islam. Despite being outnumbered and under-equipped, the Muslims achieved a decisive moral and strategic victory. This battle is not only significant for its military tactics but also for the miraculous events and profound lessons it left behind.
Today, visitors to Madinah can explore the historical area where this pivotal confrontation unfolded. The Hop-On Hop-Off bus tour in Madinah makes a convenient stop near the site, offering travelers a chance to reflect on the remarkable events that occurred there.
Historical Context of Ghazwa Khandaq
After the Muslims' growing prominence following the Battle of Badr and the setbacks of Uhud, the Quraysh and their allies sought to end the Prophet Muhammad's (ﷺ) influence permanently. A confederation of tribes formed a massive army estimated to be around 10,000 strong. In contrast, the Muslim population in Madinah was only about 3,000.
To counter this, the Prophet (ﷺ) accepted a novel idea from Salman al-Farsi: to dig a deep trench around the vulnerable parts of Madinah. This defensive tactic, unheard of in Arabian warfare, played a crucial role in neutralizing the enemy's numerical advantage.
How Long Did Digging the Trench Take?
The excavation of the trench at the Battle of Khandaq took approximately six days, though some historical sources suggest it may have lasted up to two weeks. Despite limited tools and harsh winter conditions, the Prophet (ﷺ) and his companions worked tirelessly, taking turns in shifts. The entire community participated, including the Prophet himself, exemplifying unity and perseverance during a time of crisis.
How Long Was the Ditch?
The trench spanned approximately five and a half kilometers (about 3.4 miles) and was strategically dug along the northern perimeter of Madinah, the city’s most vulnerable front. Its width was around five meters, and its depth roughly the same, making it extremely difficult for cavalry or infantry to cross. This innovative defense method effectively halted the advancing confederate forces and was instrumental in securing Madinah's safety.

Miracles of the Battle of Khandaq
1. The Splitting of the Rock
While digging the trench, the companions encountered an enormous boulder they couldn’t break. The Prophet (ﷺ) struck it three times, and with each strike came a spark of light. He used the opportunity to deliver glad tidings: the Muslims would eventually conquer the empires of Byzantium, Persia, and Yemen. This moment instilled immense hope among the weary diggers.
2. Multiplication of Food
As the Muslims worked tirelessly and faced hunger, Jabir ibn Abdullah prepared a small meal and discreetly invited the Prophet. However, the Prophet invited all the workers. In a miracle reminiscent of earlier prophetic traditions, the small amount of food sufficed for everyone, and still, leftovers remained.
3. The Divinely Sent Storm
As the siege dragged on and morale was tested, Allah sent a powerful windstorm that battered the confederate camps. Tents were torn, fires extinguished, and fear spread among the enemy ranks. This supernatural intervention forced the confederates to abandon the siege without direct combat.
4. Healing of Qatada's Eye
In the heat of preparation, Qatada ibn al-Nu'man's eye was injured to the point it was hanging from its socket. The Prophet (ﷺ) gently placed it back, and it healed instantly—with even better vision than before. In the heat of preparation, Qatada ibn al-Nu'man's eye was injured to the point it was hanging from its socket. The Prophet (PBUH) gently placed it back, and it healed instantly—with even better vision than before.

Strategic and Spiritual Lessons
1. Innovation in Warfare
The trench itself was a breakthrough in Arabian military strategy. Introduced by Salman al-Farsi and executed with collective effort, it showed how openness to new ideas can change the course of history.
2. Unity in Adversity
The shared labor of trench-digging bonded the Muhajirun and Ansar even more deeply. Despite the physical hardship and cold weather, their commitment to the cause never wavered. Cooperation and unity were key to surviving the siege.
3. Faith Over Fear
Surrounded and outnumbered, the Muslims remained steadfast. Their reliance on Allah and trust in the Prophet's leadership gave them inner strength. This battle tested not only their military tactics but also their spiritual resilience.
4. Leadership by Example
Prophet Muhammad (ﷺ) did not command from a distance. He participated in the digging, endured hunger, and shared in the hardship. His presence among the companions uplifted their spirits and demonstrated the essence of servant leadership.
Visiting the Ghazwa Khandaq Site Today
The battle of the trench site is located just outside the modern urban sprawl of Madinah, near the area of Sab'ah Masajid (Seven Mosques), which also commemorate the positions of various companions during the siege.
Using the Hop-On Hop-Off bus in Madinah, visitors can comfortably explore these historical sites while listening to audio guides that provide valuable context. The green route of the bus is ideal for those looking to immerse themselves in Islamic history without the stress of arranging separate transport.
Don't miss the opportunity to stand where the trench once was, to envision the unity and resolve of the early Muslim community. Many find it a spiritually uplifting experience to walk along these sacred paths.
Conclusion
The Battle of the Trench was not merely a military confrontation; it was a moment of profound trial, perseverance, and divine intervention. From the spark of prophecy in a broken rock to the storm that saved a city, each element carries a lesson in faith, unity, and courage.
For modern-day pilgrims and travelers, visiting this site through the Hop-On Hop-Off bus tour provides more than just sightseeing—it offers a window into a chapter of history that shaped the Islamic world.
Wishing you a meaningful journey through Madinah’s timeless legacy!