Maratha–Mysore wars

The Maratha–Mysore wars were a conflict in the 18th century India between the Maratha Confederacy and the Kingdom of Mysore. Though initial hostilities between the sides started in 1760s, the last battle began in February 1785 and ended in 1787.
The 18th century saw a steady decline of the once-dominant power on the whole subcontinent – the Mughal Empire. Apart from the disastrous invasion by the Afsharid ruler of Iran, Nader Shah in 1739, the Mughals were successfully contested by the Marathas. Meanwhile, the British East India Company was asserting its influence in India and was engaged in a series of wars with Mysore which eventually resulted in the region falling under Company rule near the end of the 18th century.
Mysore was initially a small kingdom at the beginning of the 1700s. However, able rulers such as Hyder Ali and Tipu Sultan transformed the kingdom and westernized the army & it soon turned into a military threat both to the British and the Marathas. Upon Hyder Ali’s death in 1782, Mysore covered 80,000 sq. miles and had a population of approximately 6 million people.
Starting from 1767, the Kingdom of Mysore overall had four major military confrontations with the British (1767–69; 1780–84; 1790–92; and 1799).
Around 1761, the commander in chief of the state of Mysore, Hyder Ali proclaimed himself absolute ruler of the Kingdom and started military campaigns to expand the territory of the state. In 1766, the British East India Company joined forces with the local ruler of Hyderabad against Hyder Ali, but by 1769, the British were left alone in a war with the Mysore Kingdom. In 1769 Hyder Ali made his way to Madras (the location of the Company's government) and demanded a peace treaty.
After the Second Anglo-Mysore War, the son and successor of Hyder Ali the new ruler of Mysore Tipu Sultan, sought to keep offensive moves by the Marathas at bay. The Maratha had established a military alliance with the ruler of Hyderabad with a common purpose of recovering territories both sides had lost to Mysore during previous conflicts. Much of the desired territory was subject to marches, counter-marches, and sieges of fortified points. The Marathas also attempted to draw the British East India Company into the pending conflict, but a neutrality policy implemented by the new governor-general, Lord Charles Cornwallis made its participation difficult. While the Maratha would later aid the British in the Fourth Anglo-Mysore War, the final conflict between Mysore and the Maratha by themselves happened in January 1787 in the Siege of Bahadur Benda, where Mysore successfully captured Bahadur Fort from the Marathas.
The Maratha-Mysore War ended after the final conflict during Mysore's successful siege of Bahadur Benda in January 1787, and the Marathas settled for peace with the kingdom of Mysore, to which Tipu Sultan obliged with the signing of the treaty of Gajendragad in April 1787. Tipu who was desperate to focus on defending Mysore from the British agreed to pay an annual tribute of 12 lakhs per year to the Marathas, to end hostilities with them, which would allow him to focus on his rivalry with the British. In addition to this Tipu agreed to return all territories captured by Hyder Ali from the Marathas.
Tipu Sultan would release Kalopant and return Adoni, Kittur, and Nargund to their previous rulers. Badami would be ceded to the Marathas. Tipu would also pay an annual tribute of 12 lakhs per year to the Marathas. In return, Tipu would get all the places he had captured in the war, including Gajendragarh and Dharwar. Tipu would also be addressed by the Marathas by an honorary title of "Nabob Tipu Sultan, Fateh Ali Khan".
The Marathas however ultimately betrayed Tipu, during the Fourth Anglo-Mysore War the Marathas presented their support to the British East India Company and the British went on to take over Mysore in 1799. However sometimes after Tipu's death the Marathas themselves would get involved in conflicts with the British who defeated the Marathas by 1819 in the Anglo-Maratha War leading to the annexation of their territories by the British and end of the Maratha Confederacy in India.