The last Qurayshi offensive on Madina, the Battle of the Trench, is known as thus due to the fact that trenches were dug around Madina in defense of the city. As the enemy forces in this campaign, apart from the Quraysh, were made up of various Arab tribes such as the Ghatafan, Fazara, Sulaym, Kinana and the Thaqif tribes, as well as the Banu Nadir who had been expelled from Madina and the Banu Qurayza Jews who were still residing in Madina, it has also been referred to as the campaign of “The Confederates” (Ahzab). Differing both from a political and a strategic and tactical perspective, this campaign was not conducted against one or a specific enemy but constituted a battle in defense fought against all the enemy factions in the Arabian Peninsula. This battle is also significant in terms of its having brought together all the Jewish tribes who displayed hostility towards the Muslims and who came to the realization that they would not be able to defeat the Muslims on their own, as well as the Quraysh, and the other Arab tribes.
Leading figures of the expelled Banu Nadir Jews, Huyay ibn Akhtab and Sallam ibn Abi al-Huqayq went to Makka, met with the Quraysh and incited them against the Muslims, promising their help and support. Poised for such, the Quraysh formed a large army with the participation of surrounding allied tribes. Having learned of these developments and upon the suggestion of Salman al-Farisi following consultation with his Companions, Prophet Muhammad decided on the digging of trench in the north of the city, vulnerable to enemy attack. Completed within a few weeks, and in whose construction the Prophet himself worked, the trench was – according to the estimates of Muhammad Hamidullah – approximately 5.5 kilometers in length, 9 meters in width, and 4.5 meters in depth.
At around the time when the digging was completed, an enemy force of up to 10,000 (or 12,000) men under the command of Abu Sufyan ibn Harb reached Madina and set up their military base to the north of the city, where the Battle of Uhud had previously taken place. The standard of the enemy forces was carried by ‘Uthman ibn Talha, of the Banu ‘Abd al-Dar. The Muslims numbered around 3,000 and the standard-bearer of the Emigrants was Zayd ibn Harith, while that of the Helpers was Sa’d ibn ‘Ubada. Taking into account the fact that the Muslims were outnumbered by the enemy forces, and wanting to avoid bloodshed, Prophet Muhammad did not deem it appropriate to hold a pitched battle. He ordered that women and children be placed in fortresses and citadels and set up his military base at the foothills of Mount Sal, taking the mountain as support behind them and facing the trench. He posted guards at points of weakness where the trench was not deep and at certain passageways. His strategy against the Quraysh was to show the strength of the Muslims, make the Quraysh feel dependent on him because of the trade route and make the presence of Islam and the nascent community in Madina deeply felt by them.
When the Quraysh who reached the outskirts of Madina were confronted with the trench, a hitherto unknown means of defense in Arabia, they were left stupefied. Throughout the ensuing siege, arrows and stones rained upon both sides. The Muslim army tried to prevent the enemy forces gaining access to the city via other points on the one hand, and to overpower them along the trench on the other. The enemy attacked in turns, with famed fighters such as Abu Sufyan, Hubayra ibn Abi Wahb, Ikrima ibn Abi Jahl, and ‘Umar’s brother Dirar ibn al-Khattab, Khalid ibn Walid and 'Amr ibn al-'As in command. On one occasion, the Prophet’s tent was subjected to a heavy barrage of arrows, but this attack was thwarted with the counterattack of the Companions.
At one stage during the siege, a few Quraysh cavalrymen managed to cross to the Muslim side via a narrow point of the trench. One of these men was ‘Amr ibn ‘Abd al-Wud, celebrated among Arabs for his courage and bravery. ‘Amr ibn ‘Abd al-Wud requested a warrior for one on one combat. A young ‘Ali came forward. Prophet Muhammad gave ‘Ali his sword and his turban. ‘Amr was overtaken by ‘Ali who he had initially underestimated and was killed with a sweeping blow of his sword. Nawfal ibn ‘And Allah, who crossed the trench together with him, fell into the trench and died, while the others were forced to retreat.
While there were some minor skirmishes during the siege which lasted around twenty days, the confederate forces were unsuccessful. As the Makkan polytheists had prepared for a short battle, the sources of provisions for both their troops and their mounts ran out. Meanwhile, the Muslims intercepted the food supplies and feed loaded on twenty camels and sent by the Khaybar Jews. Moreover, as the weather became extremely cold, the Makkans experienced increasing difficulty and panicked when their tents were destroyed by a heavy storm. They had approached the end of the month of Shawwal, and the sacred month of Dhu al-Qa'dah was fast approaching which meant that the season of pilgrimage was to start. Due to all these factors, Abu Sufyan knew that he could not win any significant gains, so he lifted the siege and left for Makka (5 Dhu al-Qa'dah/April 627).
Six Muslims were martyred and eight enemy soldiers killed in the Battle of the Trench, which was a turning point in Islamic history. The Muslims suffered greatly and experienced great concern when faced with large enemy forces. The Prophet’s being forced to combine the noon, afternoon, evening, (late evening) night prayers on one occasion, despite never having missed a prayer whatever the circumstance, clearly shows the extremely difficult conditions under which the Muslims were fighting. Making mention of the fear that the Muslims felt in the face of the enemy, the Qur’anic chapter entitled Al-Ahzab (The Confederates) – the eponym for the battle – states that this was a test of faith for them and that God supported them with unseen armies. (Al-Ahzab, 33:9-12; 25).
With the Battle of the Trench, the last attempt of the polytheists to annihilate the Prophet and the Muslims ended in failure. Prophet Muhammad’s political approach and diplomacy by way of creating a rift between the Jewish tribes and their allied Arab tribes, alongside his implementing an intense operation of intelligence also played an important role in the enemy’s failure. One of the precautionary measures that the Prophet took during the battle in order to weaken the enemy’s alliance relates to Nu'aym ibn Mas'ud. Leader of the Banu Ashja`, Nu’aym had only recently become a Muslim, but no one had yet found out. Upon the Prophet’s request, Nu’aym went to the Banu Qurayza and the Quraysh separately and incited them against one another. As such, the dissension which emerged in enemy ranks caused the separation of the Banu Qurayza Jews.
After the battle, Prophet Muhammad evaluated his battle strategy. The importance of acting before enemy forces in preparation for an offensive against the Muslims was seen. Accordingly, a military expedition was carried out against the Banu Qurayza.