At the start of the 18th century, the Mughals dominated the Indian subcontinent, but they were soon eclipsed by the Marathas, whose confederacy controlled northern India by the 1750s. In 1761 the Marathas themselves were defeated at the Battle of Panipat near Delhi by the Afghan ruler, Ahmed Khan Abdali, who had conquered the Punjab. They bounced back from this defeat in the Maratha Resurrection (1761–73) with victories over the Nizams of Mysore and Hyderabad, and recaptured Delhi. To the north, the Gurkhas extended their rule over all Nepal and Sikkim in the 1780s, and clashed with China in Tibet. The colonial powers had mixed fortunes; the Marathas drove the Portuguese out of western India from Goa and Diu. The French pushed the Dutch back to Ceylon. The British had victories over the French and their local allies, but their early wars against both Mysore and the Maratha were unsuccessful.
— OR —