Lahore has been the capital of Punjab for most of the last millennium. Lying on a strategic trade route between the subcontinent and Central Asia, but with little natural protection, its history is a repeating pattern of capture, destruction and rebuilding. Its origins and most of its pre-Islamic history are shrouded in legend. One story relates that it was founded by and named after Loh, son of Rama, hero of the Hindu epic Ramayana. Another is that the name comes from the ancient word loha (iron), which suggests that it may have been strongly fortified.
The first reliable reference to Lahore is in the writings of the Chinese traveller Xuan Zang, who passed through in AD 630. By the time Mahmud of Ghazni, its first Muslim ruler, invaded in 1021, Lahore was under the rule of a Brahmin king. Mahmud faced considerable problems retaining the city, but he proved triumphant and it became a regional capital in 1036 and then the capital of the entire Ghaznavid empire until 1186.
For more than three centuries Lahore passed through the hands of a succession of rival dynasties and was under constant threat of attack by Mongols. Relative peace with the Mughals came after Babur seized the city in 1524. Akbar, the third Mughal emperor, made his headquarters here from 1584 to 1598. The later Mughal emperors Jehangir and Shah Jahan also held court here. Aurangzeb, the last great Mughal emperor, didn’t spend much time in Lahore and the empire was already beginning to crumble when he died in 1707. Lahore was then fought over by feuding Mughals and the Sikhs before eventually being captured in 1759 by an Afghan, Ahmad Shah Durrani. The power shifted to the Sikhs, headed by Maharaja Ranjit Singh, from 1799 to 1839. After Singh’s death in 1839 the region plunged into a power vacuum, soon filled by the British, who seized it in 1846.
Since Partition, Lahore’s relative prosperity and stability have lured a proliferating (and occasionally unmanageable) number of migrants. So far it has coped exceedingly better with social and sectarian pressures than many other parts of Pakistan.