Ali Masjid is the narrowest point of the Khyber Pass. It is located in the Khyber Agency of the Federally Administered Tribal Areas (FATA), Pakistan. It is located around 10 miles (16 km) east of the city of Landi Kotal (West of Peshawar) and has an elevation of 3,174 feet (967 m). The width of the Khyber near Ali Masjid was earlier too narrow for two fully laden camels to pass each other but since has been widened.
Ali Masjid was named in memory of Ali, the cousin of the Islamic prophet Muhammad. A mosque and a shrine has been built here in the memory of Ali, who visited this place according to a local tradition. There is also a huge boulder which carries the marks of a hand believed to be that of Ali.
Ali Masjid has a fort built by the British in the nineteenth century which commands a strategic view over the Khyber pass. The fort has a small cemetery which contains the graves of British soldiers who fell in the second Afghan War. The valley walls bear insignias of regiments that have served here.Ali Masjid was the scene of battles during the Anglo-Afghan wars. In 1842 during the First Anglo-Afghan War, the fort was garrisoned by the British. During the disastrous retreat from Kabul, a relief force under Colonel Charles Wild was attacked by Afghan troops of Akbar Khan at the entrance of the Khyber pass and forced to fall back. The fort garrison was also forced to evacuate Ali Masjid fort and fall back to Jamrud. During the Second Anglo-Afghan War, the Peshawar Valley Field Force under General Sir Samuel Browne, during the advance on Kabul in 1878, captured this fort which was held by the Afghans under Faiz Muhammad.;