The
Gujarat Sultanate was an independent kingdom established in the early 15th century in
Gujarat. The founder of the ruling
Muzaffarid dynasty, Zafar Khan (later Muzaffar Shah I) was appointed as governor of Gujarat by Nasir-ud-Din Muhammad bin Tughluq IV in 1391, the ruler of the principal state in north India at the time, the
Delhi Sultanate. Zafar Khan defeated Farhat-ul-Mulk near
Anhilwada Patan and made the city his capital. He declared himself independent in 1407. The next sultan, his grandson Ahmad Shah I founded the new capital
Ahmedabad in 1411 on the banks of
Sabarmati River, which he styled as
Shahr-i-Mu'azzam (the great city). The prosperity of the sultanate reached its zenith during the rule of Mahmud Shah I Begada. In 1509,
the Portuguese wrested
Diu from Gujarat sultanate following the
Battle of Diu (1509). Mughal emperor Humayun attacked Gujarat in 1535. The end of the sultanate came in 1573, when
Akbar annexed Gujarat in his empire. Gujarat became a Mughal
Subah. The last ruler Muzaffar Shah III was taken prisoner to Agra. In 1583, he escaped from the prison and with the help of the nobles succeeded to regain the throne for a short period before being defeated by Akbar's general Abdur Rahim Khan-i-Khanan.