The Muslims defend Madinah by digging a trench across its open approach.
In the fifth year after the Hijrah a great confederate army besieged Madinah. The Muslims dug a trench across the open approach to the city, and the Prophet ﷺ worked with them, carrying earth and praying: “O Allah, there is no life except the life of the Hereafter, so forgive the Emigrants and the Ansar” (Sahih al-Bukhari 4098).
When the diggers met a rock they could not break, the Prophet ﷺ, with a stone tied over his stomach from hunger, came down and struck it (Sahih al-Bukhari 4101). Qur’an 33:9–10 describes the siege and Allah’s relief of the believers.