The Agra Fort was built by the Mughal Emperor Akbar between 1565-1573 as a military fortification. It served as the main residence of the Mughal emperors until Shah Jahan later shifted the capital to Delhi. While Shah Jahan added many palaces inside, Akbar commissioned the original construction.