Ajmer was founded, by tradition in the 7th century, by the Chauhan dynasty, and became their capital under rulers such as Ajayaraja, from whom the name "Ajaymeru" is said to come. Ana Sagar Lake was built in the 12th century by Arnoraja, and the city flourished until Prithviraj Chauhan was defeated in 1192.
The Sufi saint Khwaja Moinuddin Chishti settled in Ajmer in the late 12th century and died here in 1236. His shrine, the Dargah Sharif, drew pilgrims of every faith, among them the Mughal emperor Akbar, who walked to it barefoot from Agra. The Mughals made Ajmer an important base; in 1616 Jahangir received the English ambassador Sir Thomas Roe here.
Under British rule Ajmer was a directly administered province in the middle of the princely states, and Mayo College (founded 1875) was built to educate the sons of Rajput rulers. Today Ajmer is a busy pilgrimage and education centre.