Agra rose to importance when Sikandar Lodi, Sultan of Delhi, moved his court here at the start of the 16th century. In 1526 Babur, founder of the Mughal dynasty, defeated the Lodis at Panipat and laid out the first Mughal gardens along the Yamuna in Agra.
Under Akbar, Agra became the Mughal capital: from 1565 he rebuilt Agra Fort in red sandstone, and nearby he founded the new city of Fatehpur Sikri. His son Jahangir and Empress Nur Jahan added gardens and the tomb of Itmad-ud-Daulah, and Shah Jahan built the white marble palaces of the fort and, after the death of his wife Mumtaz Mahal in 1631, the Taj Mahal. In 1648 Shah Jahan moved his capital to Delhi; deposed by his son Aurangzeb, he spent his last years confined in Agra Fort.
After the Mughals, Agra passed through the hands of the Jats, the Marathas and, from 1803, the British. Today the Taj Mahal, Agra Fort and Fatehpur Sikri are all UNESCO World Heritage Sites, and the city is the middle point of the "Golden Triangle" with Delhi and Jaipur.