consolidating control over the Kashmir and Punjab regions, with Lahore being governed by Afghans. He sacked Delhi in 1757 but permitted the Mughal dynasty to remain in nominal control of the city as long as the ruler acknowledged Ahmad Shah's suzerainty over Punjab, Sindh, and Kashmir. Leaving his second son Timur Shah to safeguard his interests, Ahmad Shah left India to return to Afghanistan. Relations with China Alarmed by the expansion of China's Qing Dynasty up to the eastern border of Kazakhstan, Ahmad Shah attempted to rally neighboring Muslim khanates and the Kazakhs to unite and attack China, ostensibly to liberate its western Muslim subjects. Ahmad Shah halted trade with Qing China and dispatched troops to Kokand. However, with his campaigns in India exhausting the state treasury, and with his troops stretched thin throughout Central Asia, Ahmad Shah lacked sufficient resources to do anything except to send envoys to Beijing for unsuccessful talks. Third Battle of Panipat The Mughal power in northern India had been declining after the death of Emperor Aurangzeb, who died in 1707. In 1751–52, the Ahamdiya treaty was signed between the Marathas and Mughals, when Balaji Bajirao was the Peshwa. Through this treaty, the Marathas controlled virtually the whole of India from their capital at Pune and the Mughal rule was restricted only to Delhi (the Mughals remained the nominal heads of Delhi). Marathas were now straining to expand their area of control towards the Northwest of India. Ahmad Shah sacked the Mughal capital and withdrew with the booty he coveted. To counter the Afghans, Peshwa Balaji Bajirao sent Raghunathrao. He defeated the Rohillas and Afghan garrisons in Punjab and succeeded in ousting Timur Shah and his court from India and brought Lahore, Multan, Kashmir and other subahs on the Indian side of Attock under Maratha rule. Thus, upon his return to Kandahar in 1757, Ahmad was forced to return to India and face the formidable attacks of the Maratha Confederacy. Ahmad Shah declared a jihad (or Islamic holy war) against the Marathas, and warriors from various Afghan tribes joined his army, including the Baloch people under the command of Khan of Kalat Mir Nasir I of Kalat. Suba Khan Tanoli (Zabardast Khan) was selected as army chief of all military forces. Early skirmishes were followed by victory for the Afghans against the much larger Maratha garrisons in Northwest India and by 1759 Ahmad Shah and