 However, as the two eventually victorious khojas began to seek more independence for themselves, they soon (in autumn 1757) came into conflict with the Qing Empire.Having lost Yarkand and Kashgar to the Qing armies in 1759, they fled to Badakhshan, where they were promptly killed by the local ruler, Sultān Shāh, who sent their heads to the Qianlong Emperor.According to a legend, Iparhan, granddaughter of Apak Khoja was given to the Qianlong Emperor as a concubine.