In an attempt to bring the whole of the Deccan under control, he moved his capital to Daulatabad, Maharashtra in central India, but by moving away from Delhi he lost control of the north and was forced to return to Delhi to restore order. The southern provinces then broke away. In the years following the reign of Firuz Shah Tughlaq (1351-1388), the Delhi sultanate rapidly began to lose its hold over its northern provinces. Delhi was captured and sacked by Timur Lenk in 1398. Near Delhi, Timur massacred 100,000 captives. Delhi's decline continued under the Sayyid dynasty(1414-1451), until the sultanate was reduced to Delhi and its hinterland. Under the Afghan Lodhi dynasty (1451-1526), the Delhi sultanate recovered control of the Punjab and the Gangetic plain to once again achieve domination over northern India. However, the recovery was short-lived and in 1526 the sultanate was destroyed by Babur, founder of the Mughal dynasty.
In 1526, Babur, a descendant of Genghis Khan and Timur, from the Fergana Valley in modern-day Uzbekistan, invaded India, defeated the last Lodhi sultan in the First Battle of Panipat and founded the Mughal Empire that ruled from Delhi and Agra. The Mughal dynasty ruled Delhi for more than three centuries, with a sixteen-year hiatus during the reign of Sher Shah Suri, from 1540 to 1556. In 1553, the Hindu king, Hemu Vikramaditya acceded to the throne of Delhi by defeating forces of Mughal Emperor Humayun at Agra and Delhi. However, the Mughals re-established their rule after Akbar's army defeated Hemu during the Second Battle of Panipat in 1556. Shah Jahan built the seventh city of Delhi that bears his name Shahjahanabad, which served as the capital of the Mughal Empire from 1638 and is today known as the Old City or Old Delhi.
After 1720, the Mughal Empire's influence declined rapidly as the Hindu Maratha Empire rose to prominence. In 1737, Maratha forces sacked Delhi following their victory against the Mughals in the First