TL;DR
- The Battle of Khandaq took place in 5 AH, around 627 CE.
- It is also called the Battle of the Trench and the Battle of Al Ahzab.
- Al Ahzab means the Confederates or allied groups.
- Quraysh formed an alliance with several tribes to attack Madinah.
- Traditional reports place the Muslim force near 3,000 and the alliance near 10,000.
- Salman al Farsi suggested digging a defensive trench.
- The trench blocked the open northern approach to Madinah.
- The Muslims faced hunger, cold, fear, and pressure during the siege.
- Classical seerah sources describe a duel between Ali ibn Abi Talib and Amr ibn Abd Wudd.
- Muslim sources report that Banu Qurayza broke or threatened their agreement with Madinah.
- A powerful wind damaged the enemy camp and helped end the siege.
- Surah Al Ahzab, verses 9 to 27, discusses the crisis and its aftermath.
The Battle of Khandaq was a major siege of Madinah in 5 AH, around 627 CE. A large alliance of Quraysh and other tribes marched against the Muslims, who defended the open side of the city by digging a trench.
The trench stopped the enemy cavalry, and the siege ended after cold winds, poor supplies, distrust, and failed attacks broke the alliance. The battle became a turning point because the Quraysh failed to destroy the Muslim community despite bringing one of their largest armies.
Quick Facts About the Battle
Arabic name: غزوة الخندق
Transliteration: Ghazwat al Khandaq
Other name: Ghazwat al Ahzab
English names: Battle of the Trench and Battle of the Confederates
Date: 5 AH, around 627 CE
Location: Madinah
Muslim leader: Prophet Muhammad ﷺ
Confederate leader: Abu Sufyan ibn Harb
Main strategy: A trench across the exposed approaches to Madinah
Result: The siege failed, and the confederate army withdrew
Why Is It Called the Battle of Khandaq?
The Arabic word khandaq means a defensive trench or ditch.
The Muslims dug the trench across the open parts of Madinah that enemy horses and soldiers could use. Other parts of the city had rocky ground, hills, buildings, gardens, and natural barriers.
The battle is also called Ghazwat al Ahzab. Ahzab means groups, parties, or confederates. The name refers to the different tribes that joined forces against the Muslims.
There was no large open field battle like Badr or Uhud. The event was mainly a siege with arrows, small attacks, attempts to cross the trench, and a few direct fights.
It is still called a battle because two armed forces faced each other in an organized military campaign.
Background: Why Did the Confederates Attack Madinah?
The conflict did not begin without earlier events.
The Quraysh had already fought the Muslims at Badr and Uhud. Badr ended in a Muslim victory, while Uhud caused serious Muslim losses but did not destroy the community in Madinah.
Quraysh still saw the Muslims as a threat to their power, trade routes, and religious leadership in Arabia.
Traditional Muslim sources also report that leaders from Banu Nadir, a Jewish tribe that had been expelled from Madinah after a serious dispute, encouraged Quraysh and other tribes to form a larger alliance.
The goal was to gather enough power to end the Muslim community in one campaign.
The alliance included Quraysh and groups from Ghatafan and other Arab tribes. Abu Sufyan led the main Quraysh force.
Traditional histories often place the allied army at about 10,000 fighters. The Muslim defenders are commonly placed near 3,000.
These are historical estimates, not exact modern army records.
The Warning Reaches Madinah
The Muslims learned that the confederate army was approaching.
Prophet Muhammad ﷺ consulted his companions about how to defend Madinah. Fighting in the open would have placed the smaller Muslim force against a much larger army with strong cavalry.
Staying inside the city without blocking the open northern side would also have left Madinah exposed.
Salman al Farsi suggested a method used in Persian warfare: dig a wide trench across the open ground.
This tactic was unusual in Arabian fighting. Cavalry played a major role in battle, and a wide trench could stop horses from charging into the city.
The Prophet ﷺ accepted the idea.
This decision shows that useful knowledge was valued even when it came from another culture. The plan was not rejected because it was Persian rather than Arab.
How Large Was the Trench?
There is no single authenticated early report that gives a complete modern measurement of the trench.
Later historical and modern sources give different estimates. A commonly repeated estimate places its length near 5 to 6 kilometers. Some modern accounts describe it as about 5 meters deep and up to 9 meters wide in certain places.
These figures should be treated as estimates. The depth and width would not have been perfectly equal across the full line because the ground was uneven.
The main military requirement was simple: the trench had to be too wide for horses to jump and too difficult for soldiers to cross while Muslim archers watched from the other side.
The trench did not form a full circle around Madinah. It covered the exposed approaches, while natural and built barriers protected other sides.
Digging the Trench
The Muslims had limited time before the enemy arrived.
Men were divided into working groups, and each group was given part of the trench to dig. The Prophet Muhammad ﷺ joined the work instead of watching from a distance.
A hadith describes him carrying soil until dust covered his body. The companions also sang lines asking Allah for firmness and help as they worked.
Source: Sahih al Bukhari, Book of Military Expeditions
The digging took place during severe hunger. One report says the Prophet ﷺ tied a stone to his stomach because he had not eaten for days.
The workers also found hard rocks that slowed the digging. Sahih al Bukhari records an incident in which the Prophet ﷺ entered the trench and struck a large rock until it broke apart.
The details show that the trench was not built by a comfortable army with machines and full supplies. It was dug by hand under time pressure, hunger, and the threat of attack.
Timeline of the Battle of Khandaq
Exact day by day dates differ across historical sources. The clearest way to understand the battle is through its main phases.
Phase 1: The Confederates Form an Alliance
Quraysh and allied tribes agreed to attack Madinah together.
Each group had its own reasons. Some wanted revenge, some wanted political power, and some feared the growth of the Muslim community.
The alliance was large, but it was not one united nation. It was a collection of tribes with different leaders, goals, and levels of commitment.
This weakness would matter later.
Phase 2: The Muslims Dig the Trench
After receiving warning of the attack, the Muslims began digging across the exposed northern side of Madinah.
The Prophet ﷺ worked with the companions. Food was scarce, and the work was physically hard.
Women and children were moved into protected buildings and fortified areas.
The Muslims also prepared their defensive positions near the trench.
Phase 3: The Confederates Reach Madinah
The allied army reached Madinah expecting a more familiar type of battle.
Instead, they found a trench blocking their cavalry.
The trench removed one of their greatest advantages. Their large force could not charge directly into the city.
The confederates set up camp and began a siege.
Phase 4: Arrows, Pressure and Failed Crossings
The two sides exchanged arrows and watched the trench.
Confederate fighters searched for narrow or weak places where they might cross. Muslim defenders guarded these points.
There were several small clashes and attempts to break through, but no large part of the allied army crossed.
The siege placed heavy pressure on the Muslims. They had to guard the trench day and night while dealing with hunger, cold, and fear.
The pressure became so intense that the Prophet ﷺ and his companions were delayed from praying Asr on time during one part of the fighting.
Source: Sahih al Bukhari, reports about Al Khandaq
Phase 5: The Duel of Ali and Amr ibn Abd Wudd
Classical seerah sources report that a small group of confederate horsemen found a narrow place and crossed the trench.
Among them was Amr ibn Abd Wudd, a respected and feared Quraysh warrior.
Amr challenged the Muslims to single combat. Ali ibn Abi Talib accepted the challenge and killed him.
This event is remembered strongly in both Sunni and Shia historical traditions. Some later reports include dramatic speeches and claims about the special value of the duel, but not every detail has the same level of hadith support.
The safest historical summary is that classical Muslim sources widely report the duel and describe Ali’s victory as an important moment during an attempted crossing.
The death of Amr did not end the entire siege on its own. It did, however, stop a dangerous breach and damage enemy confidence.
Phase 6: The Banu Qurayza Crisis
While the Muslims guarded the trench, a serious threat developed inside or near Madinah.
Banu Qurayza was a Jewish tribe living in the area. Muslim sources report that the tribe had an agreement with the Muslim community but entered negotiations with the confederates or withdrew support during the siege.
This created fear of an attack from the side where Muslim families had been placed.
The Quran describes enemies coming from above and below and says that eyes became wild and hearts reached the throats.
This verse shows that the Muslims feared more than the army across the trench. They also feared being attacked from behind.
The crisis forced the Muslims to divide attention between the trench and the protected areas of Madinah.
Phase 7: The Alliance Begins to Break
The siege continued without a clear military victory.
The confederates had brought a large army, but feeding people and animals for a long siege was difficult. Cold weather made the conditions worse.
The tribes also did not fully trust each other.
Classical seerah accounts describe Nuaim ibn Masud, who had secretly accepted Islam, creating distrust between Banu Qurayza and the confederate leaders. He warned each side that the other might abandon them.
The groups then began asking each other for guarantees.
The alliance had looked powerful when it marched together. Under pressure, its internal weakness became clear.
Phase 8: The Wind and the Withdrawal
The Quran says Allah sent a wind and forces the believers could not see.
The wind damaged the confederate camp. Tents were pulled down, fires were put out, cooking pots were overturned, and the cold became harder to bear.
Hudhayfah ibn al Yaman was sent to observe the enemy camp. Reports describe Abu Sufyan ordering the army to leave because the situation had become impossible.
The Quran states that Allah drove the disbelievers back in their rage without them gaining any good.
Source: Quran 33:25
The confederate army withdrew. The siege was over.
How Long Did the Battle Last?
Historical sources differ on the exact length.
Many modern accounts describe the main siege as lasting about two weeks. Other traditional accounts place the wider crisis closer to three or four weeks.
The safest answer is that the trench campaign lasted several weeks, with the main siege often estimated at around two to four weeks.
The exact number of days is less important than the military fact: the confederates could not maintain a large army outside Madinah for long enough to break the defenses.
How Many Muslims Died in the Battle of Khandaq?
The battle had a low death count compared with the size of the armies.
Traditional lists often mention about six Muslim deaths and three confederate deaths during the trench campaign. Exact totals vary between historical accounts.
One important Muslim casualty was Saad ibn Muadh, who was wounded by an arrow during the siege. He later died from the wound.
The low number of deaths does not mean the event was unimportant. The trench prevented the large armies from meeting in a full open battle.
The main success of the strategy was that it stopped mass fighting.
The Banu Qurayza Aftermath
The Banu Qurayza event followed immediately after the confederate withdrawal.
Sahih al Bukhari records that after the Prophet ﷺ returned from the trench and put down his weapons, Jibril directed him toward Banu Qurayza.
The Muslims then surrounded their fortified area.
Banu Qurayza eventually surrendered and accepted judgment connected to Saad ibn Muadh, who had earlier been an ally of the tribe.
Traditional Muslim sources report that Saad gave a severe wartime ruling against the adult male fighters, while women and children were taken captive. Modern historians debate parts of the reported numbers and details.
This was a separate siege, but it was directly connected to Khandaq because the action was based on the reported treaty breach during the confederate attack.
The Battle of Khandaq and the Banu Qurayza event should therefore be linked, but not treated as if they were one single fight.
What Does the Quran Say About the Battle of Khandaq?
Surah Al Ahzab gives the Quranic account of the crisis.
The word Ahzab means the allied groups or confederates.
Quran 33:9: The Armies and the Wind
Allah tells the believers to remember when armies came against them. The verse says Allah sent a wind and forces they could not see.
This verse connects the enemy withdrawal with Allah’s help.
Quran 33:10: Fear From Every Side
The verse describes enemies coming from above and below. It says eyes became wild and hearts reached the throats.
This is one of the clearest descriptions of fear in the Quran.
The believers were not shown as people who felt nothing. They felt intense fear but still held their positions.
Quran 33:11: A Severe Test
The Quran says the believers were tested and shaken with a severe shaking.
Faith did not make the situation easy. It gave them a reason to remain firm while it was difficult.
Quran 33:12 to 20: The Hypocrites
These verses describe people who spread fear, made excuses, and claimed Allah and His Messenger had promised them nothing but false hope.
Some asked for permission to leave because they said their homes were exposed.
The Quran separates honest fear from defeatist behavior. A believer may feel afraid but continue to act. A hypocrite uses fear to weaken everyone else.
Quran 33:21: The Prophet as an Example
The Quran says believers have an excellent example in the Messenger of Allah.
During Khandaq, the Prophet ﷺ planned, consulted, dug, faced hunger, prayed, guarded the city, and remained with his companions.
Leadership did not mean avoiding hardship.
Quran 33:22 to 24: The Believers Remain Firm
When the believers saw the allied armies, they said this was what Allah and His Messenger had promised.
The danger increased their faith and submission.
The verses praise those who remained true to their commitment.
Quran 33:25: The Confederates Leave
The Quran says Allah sent the disbelievers back without them gaining what they wanted.
It also says Allah spared the believers from a larger fight.
This fits the nature of the battle. Victory came through defense, patience, weather, broken enemy unity, and Allah’s help rather than a massive open clash.
Quran 33:26 to 27: Banu Qurayza
These verses mention a group from the People of the Book who supported the confederates being brought down from their fortresses.
The verses connect the trench crisis to the action that followed against Banu Qurayza.
Why Did the Confederates Fail?
The wind was a major reason, but it was not the only military problem.
The Trench Blocked Their Main Strength
The alliance had more fighters and stronger cavalry.
The trench stopped them from using those advantages in a direct charge.
They Were Not Ready for a Long Siege
The army expected a faster campaign.
A large force needs food, animal feed, shelter, fuel, and steady supply lines. These needs grew more serious each day.
The Weather Became Severe
Cold wind damaged tents, fires, cooking, and sleep.
Poor weather affects morale as well as comfort.
The Alliance Lacked Unity
The confederates shared an enemy, but they did not share one clear long term goal.
When the campaign became difficult, each tribe had to decide how much more it was willing to risk.
Their Attempts to Cross Failed
Small groups crossed or approached weak areas, but the confederates could not move a large force through the trench.
The death of Amr ibn Abd Wudd also ended one dangerous attempt.
Distrust Spread Between Allies
Banu Qurayza and the outside alliance became uncertain about whether the other side would keep its promises.
An alliance built for quick victory became harder to hold together during a long failure.
Why Was Khandaq a Turning Point?
Before Khandaq, Quraysh could still organize large attacks against Madinah.
After the confederate siege failed, the balance of power began to change.
Quraysh had gathered a huge alliance and still failed to enter the city. Repeating such a campaign would be difficult and expensive.
The Muslims had shown that Madinah could survive a major regional attack.
The battle did not end all conflict, but it reduced the ability of Quraysh to control events through large offensive campaigns.
Leadership Lessons From the Battle of Khandaq
Ask for Ideas Before Making a Decision
The Prophet ﷺ consulted his companions.
Salman’s idea was accepted because it solved the problem, not because of his tribe or background.
Strong leaders do not need to pretend they already know everything.
Use Strategy Instead of Copying the Enemy
The Muslims could not match the confederates in numbers.
They changed the battlefield instead.
The trench turned enemy horses from a strength into a blocked resource.
Work Beside the Team
The Prophet ﷺ helped dig and carry soil.
People trust leaders more when leaders share the difficult work.
Prepare for More Than the Main Threat
The Muslims faced the army outside, a possible threat from behind, hunger, cold, and internal defeatism.
Good planning must consider several risks at once.
Protect Morale
The Quran records both fear and faith.
Leadership does not mean pretending that no one is afraid. It means helping people act correctly while they feel afraid.
Watch Supply Lines
The confederates had more soldiers, but more soldiers also meant more food, animals, tents, and fuel.
A large force becomes weak when its supplies fail.
Do Not Confuse Size With Unity
The confederates looked powerful because many groups stood together.
Their unity did not survive pressure.
A smaller team with clear leadership may last longer than a large alliance with weak trust.
Conclusion
The Battle of Khandaq was won before the enemy could force a major open fight.
The Muslims used consultation, new knowledge, hard work, and the natural shape of Madinah to stop a much larger army. The confederates then faced supply problems, cold weather, failed attacks, and growing distrust.
The Quran does not hide how frightening the siege was. It describes eyes becoming wild, hearts reaching the throats, and believers being severely shaken.
The victory was not a story of fear disappearing. It was a story of people staying firm while fear was still present.
Frequently Asked Questions
Quraysh and allied tribes surrounded Madinah. The Muslims dug a trench across the open approach, which stopped the enemy cavalry. After several weeks of siege, failed crossings, poor supplies, distrust, and a severe wind, the confederates withdrew.
Khandaq means trench. The battle received this name because the Muslims dug a defensive trench around the exposed side of Madinah.
It is also called the Battle of Al Ahzab, meaning the Battle of the Confederates.
Salman al Farsi suggested the trench strategy. He knew the method from Persian warfare.
No early authenticated report gives one exact modern measurement. Later estimates often place the trench near 5 to 6 kilometers long, but measurements of its width and depth vary.
Accounts differ. The siege is often described as lasting about two weeks, while some reports place the wider campaign closer to three or four weeks.
Traditional accounts commonly list about six Muslim deaths. Exact totals vary between sources.
Traditional accounts often list about three confederate deaths during the trench campaign.
The Muslims won because the confederates failed to enter Madinah and withdrew without achieving their goal.
Classical seerah sources widely report that Ali ibn Abi Talib fought and killed Amr ibn Abd Wudd after Amr crossed the trench.
Some later details about the duel have different levels of historical support.
Muslim sources report that Banu Qurayza broke or threatened their agreement with Madinah by entering talks with the confederates. This created fear of an attack from behind.
A separate siege of Banu Qurayza followed after the allied army withdrew.
Surah Al Ahzab, especially verses 9 to 27, discusses the confederate siege and its aftermath.
Yes. It was a military siege between organized armed forces. The trench prevented a large open clash, which is why the death count stayed low.
The battle shows the value of consultation, planning, teamwork, patience, and trust in Allah.
The Muslims did not defeat a larger army by copying it. They used a better defensive plan.

