 In early 1771, Mahadji, a notable Maratha general, recaptured Delhi and installed Shah Alam II as the puppet ruler on the Mughal throne.In north India, the Marathas thus regained the territory and the prestige lost as result of the defeat at Panipath in 1761.However regions of Kashmir, Khyber Pakhtunkhwa and Western Punjab, were captured by Marathas between 1758 and 1759, remained in Afghan rule before ascension of Sikh power.