In the period that followed, parts of northern Karnataka were ruled by the Nizam of Hyderabad, the Maratha Empire, the British, and other powers. In the south, the Mysore Kingdom, a former vassal of the Vijayanagara Empire, was briefly independent. With the death of Krishnaraja Wodeyar II, Haidar Ali, the commander-in-chief of the Mysore army, gained control of the region. After his death, the kingdom was inherited by his son Tipu Sultan. To contain European expansion in South India, Haidar Ali and later Tipu Sultan fought four significant Anglo-Mysore Wars, the last of which resulted in Tippu Sultan's death and the incorporation of Mysore into the British Raj in 1799. The Kingdom of Mysore was restored to the Wodeyars and Mysore remained a princely state under the British Raj.