During the Second Anglo-Maratha War, forces of the East India Company defeated Maratha forces of Daulat Rao Scindia in the Battle of Delhi; this ended Maratha control over the city and their control of the Red Fort. After the battle, the British East India Company took over the administration of Mughal territories and installed a Resident at the Red Fort. The last Mughal emperor to occupy the fort, Bahadur Shah II, became a symbol of the 1857 rebellion against the British East India Company in which the residents of Shahjahanabad participated.