Agra (; Āgrā), the former capital of Hindustan, is a city on the banks of the river Yamuna in the northern state of Uttar Pradesh, India. It is west of the state capital, Lucknow, and south of the national capital New Delhi. With a population of 1,686,976 (2010 est.), it is one of the most populous cities in Uttar Pradesh and the 19th most populous in India. Agra can also refer to the administrative district that has its headquarters in Agra city.
The city is mentioned in the epic Mahābhārata, where it was called Agrevaṇa ("the border of the forest"). Legend ascribes the founding of the city to Raja Badal Singh, a Sikarwar Rajput king (c. 1475), whose fort, Badalgarh, stood on or near the site of the present fort. However, the 11th century Persian poet Mas'ūd Sa'd Salmān writes of a desperate assault on the fortress of Agra, then held by the Shāhī King Jayapala, by Sultan Mahmud of Ghazni. Sultan Sikandar Lodī was the first to move his capital from Delhi to Agra in 1506. He died in 1517 and his son, Ibrāhīm Lodī, remained in power there for nine more years, finally being defeated at the Battle of Panipat in 1526. Between 1540 and 1556, Afghans, beginning with Sher Shah Suri, and Hindu King Hem Chandra Vikramaditya (also called Hemu), ruled the area. It achieved fame as the capital of the Mughal Empire from 1556 to 1658. In the 18th century, it came under Jat rule. It is a major tourist destination because of its many splendid Mughal-era buildings, most notably the Tāj Mahal, Agra Fort and Fatehpūr Sikrī, all three of which are UNESCO World Heritage Sites.
This area was inhabited by the Agre clan of the Jats and hence its meaning is 'the forest of Agre people'. Ptolemy, the famous second century A.D. geographer, marked it on his map of the world as Agra. 
Though Agra's history is largely recognised with Mughal Empire, the place was established much before it and has linkages since Mahabharat period and Mahirshi Angira in 1000 BC. It is generally accepted that Sultan Sikandar Lodī, the Ruler of the Delhi Sultanate founded Agra in the year 1504. After the Sultan's death the city passed on to his son Sultan Ibrāhīm Lodī. He ruled his Sultanate from Agra until he fell fighting to Bābar in the First battle of Panipat fought in 1526.
In the year 1556, the great Hindu warrior Hemu Vikramaditya, also known as Samrat Hem Chander Vikramaditya, won the state of Agra as the Prime Minister cum Chief of Army of Adil Shah of the Afghan Sūrī Dynasty. The commander of Humāyūn / Akbar's forces in Agra, Tardi Beg Khan, was so scared of Hemu that he retreated from the city without a fight. This was Hemu's 21st continuous win since 1554, and he later went on to conquer Delhi, having his coronation at Purānā Qil'a in Delhi on 7 October 1556 and re-established the Hindu Kingdom and the Vikramaditya Dynasty in North India.
The golden age of the city began with the Mughals. It was known then as Akbarabād and remained the capital of the Mughal Empire under the Emperors Akbar, Jahāngīr and Shāh Jahān. Shāh Jahān later shifted his capital to Shāhjahānabād in the year 1649.
Since Akbarabād was one of the most important cities in India under the Mughals, it witnessed a lot of building activity. Babar, the founder of the Mughal dynasty, laid out the first formal Persian garden on the banks of river Yamuna. The garden is called the Arām Bāgh or the Garden of Relaxation. His grandson Akbar raised the towering ramparts of the Great Red Fort, besides making Agra a center for learning, arts, commerce and religion. Akbar also built a new city on the outskirts of Akbarabād called Fatehpūr Sikrī. This city was built in the form of a Mughal military camp in stone.
His son Jahāngīr had a love of gardens and flora and fauna and laid many gardens inside the Red Fort or Lāl Qil'a. Shāh Jahān, known for his keen interest in architecture, gave Akbarabād its most prized monument, the Tāj Mahal. Built in loving memory of his wife Mumtāz Mahal, the mausoleum was completed in 1653.
Shāh Jahān later shifted the capital to Delhi during his reign, but his son Aurangzeb moved the capital back to Akbarabād, usurping his father and imprisoning him in the Fort there. Akbarabād remained the capital of India during the rule of Aurangzeb until he shifted it to Aurangabad in the Deccan in 1653. After the decline of the Mughal Empire, the city came under the influence of Marathas and was called Agra, before falling into the hands of the British Raj in 1803.
In 1835 when the Presidency of Agra was established by the British, the city became the seat of government, and just two years later it was witness to the Agra famine of 1837–38. During the Indian rebellion of 1857 British rule across India was threatened, news of the rebellion had reached Agra on 11 May and on 30 May two companies of native infantry, the 44th and 67th regiments, rebelled and marched to Delhi. The next morning native Indian troops in Agra were forced to disarm, on 15 June Gwalior (which lies south of Agra) rebelled. By 3 July the British were forced to withdraw into the fort. Two days later a small British force at Sucheta were defeated and forced to withdraw, this led to a mob sacking the city. However, the rebels moved onto Delhi which allowed the British to restore order by 8 July. Delhi fell to the British in September, the following month rebels who had fled Delhi along with rebels from Central India marched on Agra but were defeated. After this British rule was again secured over the city until the independence of India in 1947.
Agra is the birthplace of the religion known as Dīn-i Ilāhī, which flourished during the reign of Akbar and also of the Radhaswami Faith, which has around two million followers worldwide. Agra has historic linkages with Shauripur of Jainism and Runukta of Hinduism, of 1000 BC.
Tāj Mahal, Agra Fort and Fatehpur Sikri are all UNESCO World Heritage Sites.