The Meccans...
The Meccans, four thousand strong, including three hundred cavaliers and fifteen hundred camels, were joined by six thousand allies from among the Jews and the bedouin tribes. The three armies set out, ten thousand strong, under the command of Abu Sufyan in the beginning of the month of Shawwal, 5 A.H. (the end of February 627 A.D.) to attack Medina. When news of these preparations reached Medina, the Prophet consulted his companions, as he always did during such situations.
There was hardly sufficient time to make preparations for the war. He decided this time to remain within the city and fight back. The stone houses of the city were built adjacent to one another so as to make a high and continuous strong wall for a long distance except in the north-west where a wide open space could afford the enemy an easy entry.
At this place, with the suggestion of Salman al-Farisi, who was familiar with the mode of defending cities in other countries such as his home country (Persia), a trench, fifteen feet in width and fifteen feet in depth, was dug up. Muslims were divided into parties of 10 each, and each party was allotted 10 yards to dig. The Prophet himself participated in this task, carrying the excavated earth away.
The khandaq (moat) was completed in the nick of time: just 3 days before the host of the enemies reached Medina. The houses outside the city were evacuated, and the women and children were accommodated for safety on the tops of the double-storied houses at the entrenchment. Muslims could muster only three thousand men to face this huge army, and they immediately took cover behind the ditch.
The Propeht camped in the center of the entrenchment in a tent of red leather on a space shaped like a crescent. The camp had the rising ground of Sila` on its rear and the trench in the front. Huyaiy ibn Akhtab, head of Banu Nadir Jews of Medina, met secretly with Ka`b ibn Asad, head of Banu Quraizah, another Jewish tribe which was still in Medina. Huyaiy was the most antagonistic Jew towards the Prophet (ص).
Banu Quraizah, on his instigation, tore down the treaty which they had concluded with the Muslims. The Jews decided that they would assist the pagan Quraishites after ten days' preparations and would attack the rear of Muhammad's army from the north-western side of the city which was located on the south-east side of their fortress and which was easily accessible to them.