The subcontinent's first hill fort was built here-Taragarh Fort in the 7th century. The ruins of this fort by the Anasagar Lake are still visible in Ajmer. The city was very coveted because of its strategic location on the major trade route between Delhi and the sea coast of Gujarat and on the royal road leading from Delhi to the heart of Rajputana.
The kingdom of Ajmer was ruled by Prithviraj Chauhan, Raja of Delhi and Ajmer. In the year 1191 the First Battle of Tarain started between Prithviraj Chauhan and Mohammed Ghori, an Afghan governor. In the second Battle of Tarain the Afghan forces crushed the Rajput cavalry and the emblematic figure of Rajput heroism was taken a prisoner and put to death. The name, Prithviraj Chauhan still remembered in the domain of Rajasthan with great respect because he was the last Hindu king of Delhi. His chivalry, intelligence and valor made him one of the most revered kings in Rajasthan.
The deeds of Prithviraj Chauhan, his fierce resistance, his desperate battles and his proud honour makes an epic poem made of 69 books, the 'Prithviraj Raso' which was recited by bards from one kingdom to the other. The poems continue to immortalize the spirit of Prithviraj Chauhan. Ajmer remained under the reign of Delhi Sultanate till 1326. After the Sultanate rule several battles ensued to between various clans to conquer Ajmer.
Political stability returned only after Akbar, the Mughal Emperor ascended the throne in Delhi. It became an important center for the Mughal emperor, as he was a devout follower of Moinuddin Chisti. The dargah sharif was quite important to him. He fortified the city and built his own palace here, Daulat Khana. Jahangir also lived in Ajmer from 1613 to 1616. After the Mughal rule it was under the control of the Marathas. But with the advent of the British the scenario changed.
Ultimately in the 19th century, it became the base for the British operations. In the year 1947 it was merged with the state of Rajasthan and was stopped being recognized as a princely state.