Afaq Khoja (Uyghur: ئاپاق خوجا), born Hidayat Allah (Uyghur: هدایتالله; Chinese: 伊達雅圖勒拉), also known as Apaq Xoja or more properly[note 1] Āfāq Khwāja (Persian: آفاق خواجه), was a Naqshbandi īshān[1] and political leader with the title of Khwaja in Kashgaria (in present-day Southern Xinjiang, China).
During the reign of Rashid Khan, the celebrated saint Sayyid Khoja Hasan, more generally known as Makhdum-i-Azam (مخدومِ اعظم) or "The Great Master", visited Kashgar from Samarkand and was received with extraordinary honours.
The saint's sons settled at Kashgar, where their father had married a wife and had received rich estates, and gradually established a theocracy, laying upon the necks of the submissive, apathetic people a heavy yoke which they still bear.
In this diplomatic mission Tibet Muslims played a crucial role by convincing the 5th Dalai Lama to write a letter of introduction to the Dzungar Khanate.
After Yahiya Khoja's death (he was killed by Apak Khoja's wife Khanam Padshah, who was a daughter of Sultan Said Baba Khan, ruler of Turpan and Chalish), Muhammad Mumin Sultan (Akbash Khan, r. 1695–1706) restored the Chagatay (Moghul) dynasty of Yarkand, attempting to get rid of the Dzungar mandate, but finally he fled to India.
On that tour, he visited Xining (today's Qinghai province), Lintao, and Hezhou (now Linxia), and was said to convert some Hui and many Salars there to Naqshbandi Sufism.
At the same time, Khoja Jahan, executing Khoja Burhan ad-Din's order, razed to ground in 1755 both Dzungar temples, Golden and Silver, in Ghulja and Kainuk cities of Ili River Valley, that were built by Galdan Boshugtu Khan and represented the sacred symbols of Dzungar Power[citation needed].
Establishing Qing hegemony over Dzungaria and the Tarim Basin they waged in 1755-1756 a bloody war against their old rivals, the Karataghliks, who previously took total control of Kashgaria since 1752 after successful anti-Dzungar revolt of Khoja Yusup (1752-1755), having terminated annual tribute payments to Dzungars.
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.
Under Qing auspice, Khojijan rulers of city states often fell out of favor of the hegemonic power and had to flee to Uzbek protection in the Khanate of Kokand.
By the 19th century, prominent Afaqi Khojas (Khojijans) in exile in Kokand sought to influence their former domains through preaching or allying with new imperialist powers of Russia and Great Britain.
It was during the 1800s that two major attempts were launched from Kokand to claim the "Six City State of Tarim Basin" ( Altı Shahr ) from Qing domination.
The Chinese warlord and Military Governor (Duban) of Sinkiang general Sheng Shicai (April 12, 1933- August 29, 1944) restored the status of several of these local rulers to facilitate his rule.
[7] "This was the famous shrine, and we were invited to step inside, where we saw a crowded mass of bluetiled tombs, that of the Saint-King being draped with red and white cloths.
While there he had married his daughter to a Chinaman, and at the date of our visit a Celestial had arrived in Kashgar accompanied by a band of relatives, to demand his share of the great wealth of the shrine.