In 1761, the Maratha army lost the Third Battle of Panipat to Ahmad Shah Abdali of the Afghan Durrani Empire which halted their imperial expansion into Afghanistan. Ten years after Panipat, the Peshwa Madhavrao I's Maratha Resurrection reinstated Maratha authority over North India. In a bid to effectively manage the large empire, he gave semi-autonomy to the strongest of the knights, which created a confederacy of Maratha states. They became known as the Gaekwads of Baroda, the Holkars of Indore and Malwa, the Scindias of Gwalior and Ujjain, the Bhonsales of the Nagpur and the Puars of Dhar & Dewas. In 1775, the East India Company intervened in a Peshwa family succession struggle in Pune, which became the First Anglo-Maratha War. The Marathas remained the preeminent power in India until their defeat in the Second Anglo-Maratha War which left the East India Company in control of most of India. They were defeated due to lack of unity.