 The kingdom reached the height of its military power and dominion in the latter half of the 18th century under the de facto rulers Hyder Ali and his son Tipu Sultan. The latter demolished parts of Mysore to remove legacies of the Wodeyar dynasty. During this time, Mysore kingdom came into conflict with the Marathas, the British and the Nizam of Golconda, leading to the four Anglo-Mysore wars, success in the first two of which was followed by defeat in the third and fourth. After Tipu Sultan's death in the Fourth Anglo-Mysore War in 1799, the capital of the kingdom was moved back to Mysore from Seringapatam, and the kingdom was distributed by the British to their allies of the Fourth Mysore war. The landlocked interior of the previous Mysore Kingdom was turned into a princely state under the suzerainty of the British Crown. The former Wodeyar rulers were reinstated as puppet monarchs, now styled Maharajas. The British administration was assisted locally by Diwan (chief minister) Purnaiah. Purnaiah is credited with improving Mysore's public works. Mysore lost its status as the administrative centre of the kingdom in 1831, when the British commissioner moved the capital to Bangalore. It regained that status in 1881 and remained the capital of the Princely State of Mysore within the British Indian Empire until India became independent in 1947.
