The term "Cathay" came from the name for the Khitans. A form of the name "Cathai" is attested in a Uyghur Manichaean document circa 1000. The Khitans refer to themselves as Qidan, but in the language of the ancient Uyghurs the final -n or -ń became -y, and this form may be the source of the name "Khitai" for later Muslim writers. This version of the name was then introduced to medieval and early modern Europe via Muslim and Russian sources.