Moradabad was established as an office for the Chaupala pargana during emperor Akbar's regime. In AD 1624 it was captured by Rustam Khan, the then Governor of Sambhal who named it Rustam Nagar. Later, in AD 1625 its named was changed to Moradabad, after the name of prince Murad Baksh, the son of Mughal emperor Shah Jahan. A mosque named Jama Masjid was constructed in the city by Rustam Khan for the Mughal Emperor.