It is generally accepted that Agra was both an ancient city from the times of the Mahabharata (see above) and yet nevertheless Sultan Sikandar Lodī, the Muslim 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 Mughal Badshah (emperor) Bābar in the First battle of Panipat fought in 1526. 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 Badshahs (emperors) Akbar, Jahāngīr and Shāh Jahān. Akbar made it the eponymous seat of one of his original twelve subahs (imperial top-level provinces), bordering (Old) Delhi, Awadh (Oudh), Allahabad, Malwa and Ajmer subahs. Shāh Jahān later shifted his capital to Shāhjahānabād in the year 1649.