The Mahmud Ghaznavi Mosque sits on the lower slopes below Raja Gira Castle in Udegram, about 10 km southwest of Mingora, and dates to the Ghaznavid period in the mid-11th century. An Arabic inscription found on the hillside in 1984 dates its foundation to 1048–49 CE, making it one of the oldest identified mosques in northern Pakistan.
This guide covers the mosque's history, what remains on site, and how to combine the visit with the castle ruins above it.
| At a glance | |
|---|---|
| Location | Udegram, about 10 km from Mingora |
| Date | Ghaznavid period, foundation dated 1048–49 CE |
| Discovered | 1985, by the Italian Archaeological Mission |
| Excavated | 1985–1999 |
| Entry fee | None reported |
The history behind the site
Mahmud of Ghazni's campaigns brought his armies into Swat in the early 11th century, part of the wider Ghaznavid expansion into the northwest of the subcontinent. Local tradition credits Mahmud with bringing Islam to the valley, and the mosque that bears his name was built on the hillside below the older fortress of Raja Gira not long afterwards, under Mahmud himself or his grandson Mawdud.
The mosque's date rests on firmer evidence than most of the legends attached to Udegram: a black marble slab found on the hill in 1984, inscribed in Arabic, records the foundation of a mosque in the Islamic year 440 (1048–49 CE), commissioned by a Ghaznavid general named Nushtagin. The Italian Archaeological Mission in Pakistan, working in Swat since the 1950s, identified and began excavating the mosque itself in 1985, with work continuing through to 1999.
What the excavation found
The dig uncovered a hypostyle mosque, meaning its roof was originally carried on rows of wooden columns rather than a single dome, built with local stone. Excavators also found walls up to 30 feet high in places, a graveyard, a group of small rooms thought to have housed students, and a water mill, suggesting the mosque was the centre of a small religious settlement rather than a standalone building.
What survives today is largely the stone footprint and lower walls rather than a complete standing structure. It is a site for anyone interested in the archaeology and the story rather than a working mosque to pray in.
Visiting the site
The mosque sits a short walk up from Udegram village, on the same hillside as Raja Gira Castle but well below the steepest part of that climb, so it is accessible to visitors who would rather skip the fortress hike. There is no ticket office or formal signage; ask locally for directions if the path is not obvious.
Our separate guide to Raja Gira Castle covers the longer climb to the fortress above, including how long it takes and what remains to see.
Getting there
Udegram is a short, paved drive southwest of Mingora, easily managed as part of a half-day trip. There is no scheduled public transport for visitors; a hired car or taxi from Mingora is the straightforward option. Our Swat valley guide covers getting around the wider district.
Is it worth visiting?
If you are combining it with the climb to Raja Gira Castle, yes, the mosque adds real historical depth to the trip for very little extra walking. On its own, without the castle, it is a modest ruin that will mean most to visitors already interested in the region's early Islamic and archaeological history rather than casual sightseers.
Is it safe to visit Udegram?
Udegram is a settled village close to Mingora and receives regular domestic visitors. The UK government's Pakistan travel advice (updated September 2026) currently advises against all travel to Swat district, following a suicide bombing at Kabal police station in August 2026 that killed 17 people. Pakistanis travel through the district in large numbers, but anyone planning a visit, particularly holders of foreign passports, should check current advice and recent local news before travelling, since a foreign government's advisory can also affect travel insurance.
Frequently asked questions
How old is the Mahmud Ghaznavi Mosque in Udegram?
An inscription found on site dates its foundation to 1048–49 CE, during the Ghaznavid period, making it one of the oldest identified mosques in northern Pakistan.
Can I still pray at the mosque?
No. What survives is an archaeological site, largely stone foundations and lower walls, rather than a functioning building.
Is there an entry fee?
No fee is reported, and there is no formal ticket office at the site.
How far is the mosque from Raja Gira Castle?
They sit on the same hillside above Udegram. The mosque is a short walk from the village, well below the steeper climb up to the castle ruins.
How do I get to Udegram from Mingora?
It is a short drive, about 10 km, southwest of Mingora on a paved road. A hired car or taxi from Mingora is the practical way to reach it.