Shahu, a grandson of Shivaji and son of Sambhaji, was kept prisoner by Aurangzeb during the 27-year period conflict. After the latter's death, his successor released Shahu. After a brief power struggle over succession with his aunt Tarabai, Shahu ruled the Maratha Empire from 1707 to 1749. Early in his reign, he appointed Balaji Vishwanath and later his descendants, as Peshwas (prime ministers) of the Maratha Empire. The empire expanded greatly under the leadership of Balaji's son, Peshwa Bajirao I and grandson, Peshwa Balaji Bajirao. At its peak, the Maratha empire stretched from Tamil Nadu in the south, to Peshawar (modern-day Khyber Pakhtunkhwa) in the north, and Bengal. In 1761, the Maratha army lost the Third Battle of Panipat to Ahmed Shah Abdali of the Afghan Durrani Empire, which halted their imperial expansion in northwestern India. Ten years after Panipat, Marathas regained influence in North India during the rule of Madhavrao Peshwa.