Kingdom of Khotan
Muslim accounts tell the tale of the four imams from Mada'in city (possibly now in Iraq) who travelled to help Yusuf Qadir Khan, the Qarakhanid leader, in his conquest of Khotan, Yarkend, and Kashgar. The "infidels" were said to have been driven towards Khotan, but the four Imams were killed. In 1006, Yusuf Qadir Khan of Kashgar conquered the Kingdom of Khotan, ending Khotan's existence as an independent state.