The Seven Mosques of Madinah and the Battle of the Trench

On the western side of Madinah, near Mount Sal’, is a group of small mosques known as al-Masajid al-Sab’ah, the Seven Mosques. They mark the area where the Muslims defended Madinah during the Battle of the Trench (al-Khandaq), one of the most important events in the city’s history.

In this guide you will find the history and significance of The Seven Mosques (Khandaq), where it is and how far it is from the Haram, the best time to visit, simple etiquette, practical tips and how to get there comfortably with a private Zikr Cabs car. It is part of our Madinah Ziyarat Guide.

History and significance of The Seven Mosques (Khandaq)

In 5 AH (627 CE), a large alliance of tribes, often counted at around 10,000 fighters, marched on Madinah. On the advice of Salman al-Farisi (may Allah be pleased with him), the Prophet ﷺ ordered a trench to be dug across the open northern approach to the city. The companions dug it in bitter cold and hunger, and the Prophet ﷺ worked beside them.

The siege lasted for about a month. Then Allah sent a strong, cold wind that broke the camps of the confederates, and they withdrew. The Qur’an describes these events in Surah al-Ahzab (33:9–27).

Over time, small mosques were built at points connected with the battle, traditionally where the Prophet ﷺ and some companions prayed or kept watch. The best known is Masjid al-Fath, on a slope of Mount Sal’. Others are named after Salman al-Farisi, Abu Bakr, Umar, Ali and Fatimah. Despite the name, the number has varied through history. Some of the small mosques have been removed, and a large modern mosque, Masjid al-Khandaq, now serves the area.

Where is The Seven Mosques (Khandaq)? Location and distance

The Seven Mosques area is about 3–4 km north-west of Al-Masjid an-Nabawi, close to Masjid al-Qiblatain. The drive takes about 10 minutes.

Distances and travel times are approximate and depend on your hotel, the route and traffic, especially in Ramadan and the Hajj season.

Best time to visit and etiquette

Morning or late afternoon. The old small mosques may be closed, but you can walk around them and pray in Masjid al-Khandaq.

No special rituals are linked to these mosques. Pray in the open mosque if you wish, and reflect on the patience of the companions during the siege.

As with all ziyarat, it helps to keep the right intention. Visiting historical places is not part of the rites of Umrah or Hajj. It is a chance to learn, to reflect on the lives of the Prophet ﷺ and his companions, and to make du’a. Scholars remind us not to seek blessing from rocks, walls or soil, and to follow the Sunnah in what we say and do. Religious rulings can differ between schools of thought, so ask a qualified scholar about your own situation.

Combining The Seven Mosques (Khandaq) with other ziyarat

Most pilgrims visit The Seven Mosques (Khandaq) as part of a wider tour rather than on its own. Nearby places that fit well on the same trip include Masjid al-Qiblatain, Masjid Quba, Jabal Uhud & the Martyrs of Uhud, Masjid al-Ghamama and Bir Uthman (Well of Rumah). Each has its own guide, linked at the end of this page. A good plan is to choose three or four places for one morning, starting with the one that needs the most walking while it is still cool, and to leave time for rest and prayer. If you only have one free morning, our suggested route in the Madinah Ziyarat Guide shows a practical order that avoids driving back and forth across the city.

Visiting The Seven Mosques (Khandaq) with family, children and elderly pilgrims

Ziyarat with family is a special memory, but it is easy to try to do too much. Keep the day short and gentle: plan around prayer times, take water and light snacks, and let anyone who is tired rest in the air-conditioned car while others step out. For wheelchair users, ask your driver to stop as close as the rules allow, and remember that some paths and steps are not suitable for wheelchairs. Teach children a short story about each place before you arrive, so the visit becomes a lesson they remember. Above all, keep the visit calm and respectful, as others around you may be in quiet prayer or reflection.

Practical tips for your visit

  • Visit together with Masjid al-Qiblatain, which is nearby.
  • Some steps lead up to Masjid al-Fath; take care in the heat.
  • Ask your driver to point out where the trench is believed to have run.
  • Dress modestly and carry water, especially from May to September, when temperatures can pass 45°C.
  • Keep your ID and the Nusuk app with you, as some areas have checkpoints, and access rules can change, so follow the instructions of officials on site.

How to get to The Seven Mosques (Khandaq) with Zikr Cabs

The easiest way to visit The Seven Mosques (Khandaq) is with a private car that waits for you. With Zikr Cabs, your driver collects you from your hotel, takes you to The Seven Mosques (Khandaq) and other nearby sites at your own pace, and brings you back in time for prayer. You never have to bargain with street taxis or wait for a crowded bus.

The Seven Mosques (Khandaq) is included in our Madinah Ziyarat taxi tour, which starts from SAR 190 for a sedan. Fares are fixed per vehicle, not per person, and larger cars such as the GMC Yukon, Hyundai H1/Staria, Toyota Hiace and Coaster are available for families and groups. See all vehicles and prices on our routes and prices page. * Rates exclude VAT.

Frequently asked questions about The Seven Mosques (Khandaq)

Why are they called the Seven Mosques?

They are a group of small historic mosques at the site of the Battle of the Trench. The number has varied over time.

When was the Battle of the Trench?

In 5 AH (627 CE).

Who suggested digging the trench?

Salman al-Farisi (may Allah be pleased with him).

Are all the mosques still open?

Some old mosques are closed or have been removed. The large Masjid al-Khandaq is open for prayer.

Is it part of the Madinah ziyarat tour?

Yes, usually together with Masjid al-Qiblatain.

Nearby ziyarats

← Back to the Madinah Ziyarat Guide

Sources and further reading

This guide is general information for pilgrims. Official rules on permits and access change often; please check Nusuk and the Ministry of Hajj and Umrah before you travel.

Book on WhatsApp
WhatsApp