Panchkula district was formed as the 17th district of the Indian state of Haryana on 15 August 1995. It comprises two sub divisions and two tehsils: Panchkula and Kalka. It has 264 villages out of which twelve are un-inhabited and ten wholly merged with towns or treated as census towns according to the 1991 census. There are five towns in the district: Barwala, Kalka, Panchkula, Pinjore and Raipur Rani. The total population of the district is 319,398 out of which 173,557 are males and 145,841 are females. it was the least populous district of Haryana. Panchkula city is the headquarters of this district. Chandimandir Cantonment is located in this district, adjoining the Panchkula Urban Estate. Panchkula takes its name from Panch khul, five natural springs in the area. The earlier main town in the region was Pinjore. Near the later part of the 7th century and early part of the 8th century, the district was part of the empires of Yasovarman of Kannauj and Lalitaditya Muktapida of Kashmir. It was part of the empire of Mihir Bhoj of the Gujara-Pratihara dynasty. In the 10th century CE, the region was raided by Mahmud of Ghazni several times. However it was soon brought back to peace by the Chauhans of Delhi, until Muhammad Ghori defeated Prithviraj Chauhan in 1192, when it became part of the Delhi Sultanate. In 1254, Nasiruddin Muhammad plundered Pinjore, an event recorded in the Tabakhat-i-Nasiri. Timur sacked Pinjore on his return from Delhi. After Timur's invasion, Panchkula fell out of central control until 1450, when Bahlol Lodhi, then governor of Punjab, restored central control over the region as Sultan. Panchkula remained in Lodhi hands until Babur crushed the Lodhis at the Battle of Panipat and set up the Mughal Empire. Panchkula was part of the Sirhind Sarkar of Delhi Subah. During the reign of Aurangzeb, Fidai Khan Koka, his Master of Ordinance, constructed the Pinjore Gardens (now called Yadvindra Gardens) for use by Aurangzeb as a summer retreat.