Lahore: History
=== Origins ===
No definitive record of Lahore's early history exists, and its ambiguous historical background has given rise to various theories about its establishment and history.
Alexander the Great's historians make no mention of any city near Lahore's location during his invasion in 326 BCE, suggesting the city had not been founded by that point or was not noteworthy. Ptolemy mentions in his Geography a city called Labokla situated near the Chenab and Ravi rivers which may have been in reference to ancient Lahore, or an abandoned predecessor of the city. Chinese pilgrim Xuanzang gave a vivid description of a large and prosperous unnamed city that may have been Lahore when he visited the region in 630 CE during his tour of India.
The first document that mentions Lahore by name is the Hudud al-'Alam ("The Regions of the World"), written in 982 CE, in which Lahore is mentioned as a town which had "impressive temples, large markets and huge orchards".
Few other references to Lahore remain from before its capture by the Ghaznavid Sultan Mahmud in the 11th century. During this time, Lahore appears to have served as the capital of Punjab under Raja Anandapala of the Üdi Shahi empire, who moved his capital there from Waihind.
==== Ghaznavid ====
Sultan Mahmud conquered Lahore between 1020 and 1027, making it part of Ghaznavid Empire. He appointed Malik Ayaz as its governor in 1021. During the reign of Sultan Ibrahim Malik Ayaz rebuilt and repopulated the city, which had been devastated after the Ghaznavid invasion. He also erected city walls and a masonry fort in 1037–1040 on the ruins of a previous one. During his tenure a confederation of Hindu princes unsuccessfully laid siege to Lahore in 1043–44.
Lahore was formally made the eastern capital of Ghaznavid Empire during the reign of Khusrau Shah in 1152. After the fall of Ghazni in 1163, It became the sole capital. Under their patronage, poets and scholars from other cities of Ghaznavid Empire congregated in Lahore. The city became a cultural and academic centre, renowned for poetry. The entire city of Lahore during the Ghaznavid era was probably located west of the modern Shah Alami Bazaar and north of the Bhatti Gate.
Following the siege of Lahore in 1186, the Ghurid ruler Muhammad captured the city and imprisoned Khusrau Malik, thus ending Ghaznavid rule over Lahore. Lahore was the first capital of the Mamluk dynasty of what would later come to be known as the Delhi Sultanate following the assassination of Muhammad of Ghor in 1206. Under the reign of Mamluk sultan Qutb-ud-Din Aibak, Lahore attracted poets and scholars from medieval Muslim World. Lahore at this time had more poets writing in Persian than any other city. Following the death of Aibak, Lahore first came under the control of the governor of Multan, Nasir ad-Din Qabacha, and then was briefly captured in 1217 by the sultan in Delhi, Iltutmish.
In an alliance with local Khokhars in 1223, the Khwarazmian sultan Jalal al-Din Mangburni captured Lahore after fleeing from Genghis Khan's invasion of his realm. Mangburni then fled from Lahore to the city of Uch Sharif after Iltutmish's army re-captured Lahore in 1228. …