From 1429 to 1531 it was a protectorate of the Bengal Sultanate at different time periods.[1] After gaining independence from Bengal, it prospered with help from the Portuguese settlement in Chittagong. In 1666, it lost control of Chittagong after a war with the Mughal Empire.