The city was founded in 1569 by the Mughal Emperor Akbar, and served as the capital of the Mughal Empire from 1571 to 1585, when it was abandoned. After his military victories over Chittor and Ranthambore, Akbar decided to shift his capital from Agra to a new location 23 miles (37 km) west south-west, to honour the Sufi saint Salim Chishti. Here, he commenced the construction of a planned walled city, which took the next fifteen years in planning and construction, with a series of royal palaces, harem, courts, a mosque, private quarters and other utility buildings.