Tipu's successful attacks in 1790 on the Kingdom of Travancore, a British ally, was an effective victory for him, however it resulted in greater hostilities with the British which resulted in the Third Anglo-Mysore War. In the beginning, the British made gains, taking the Coimbatore district, but Tipu's counterattack reversed many of these gains. By 1792, with aid from the Marathas who attacked from the north-west and the Nizam who moved in from the north-east, the British under Lord Cornwallis successfully besieged Srirangapatna, resulting in Tipu's defeat and the Treaty of Srirangapatna. Half of Mysore was distributed among the allies, and two of his sons were held to ransom. A humiliated but indomitable Tipu went about re-building his economic and military power. He attempted to covertly win over support from Revolutionary France, the Amir of Afghanistan, the Ottoman Empire and Arabia. However, these attempts to involve the French soon became known to the British, who were at the time fighting the French in Egypt, were backed by the Marathas and the Nizam. In 1799, Tipu died defending Srirangapatna in the Fourth Anglo-Mysore War, heralding the end of the Kingdom's independence. Modern Indian historians consider Tipu Sultan an inveterate enemy of the British, an able administrator and an innovator.