Delhi has the second largest Muslim population (12.86%) within Delhi State. Muhammad Ghori invaded India in 1175 A.D. After the conquest of Multan and Punjab, he advanced towards Delhi. The Rajput chiefs of northern India headed by Prithvi Raj Chauhan defeated him in the First Battle of Terrain in 1191 A.D. After about a year, Muhammad Ghori came again to avenge his defeat. A furious battle was fought again in Terrain in 1192 A.D. in which the Rajputs were defeated and Prithvi Raj Chauhan was captured and put to death. The Second Battle of Terrain, however, proved to be a decisive battle that laid the foundations of Muslim rule in Northern India. Ghori built many mosques and libraries after laying Muslim rule in India. The period between 1206 A.D. and 1526 A.D. in India's history is known as the Delhi Sultanate period. During this period of over three hundred years, five dynasties ruled in Delhi. These were: the Slave dynasty (1206-90), Khilji dynasty (1290-1320), Tughlaq dynasty (1320-1413), Sayyid dynasty (1414-51), and Lodhi dynasty (1451-1526).The Delhi Sultanate was an Islamic empire based in Delhi that stretched over large parts of the Indian subcontinent for 320 years (1206–1526). Five dynasties ruled over the Delhi Sultanate sequentially: the Mamluk/Slave dynasty (1206–1290), the Khalji dynasty (1290–1320), the Tughlaq dynasty (1320–1414), the Sayyid dynasty (1414–1451), and the Lodi dynasty (1451–1526). It covered large swathes of territory in modern-day India, Pakistan, Bangladesh as well as some parts of southern Nepal.