The dynasty was established by Shah Mir in 1339 CE, there are two theories regarding Shah Mir's origin. Historian A. Q. Rafiqi states that some Persian chronicles of Kashmir describe Shah Mir as a descendant of the rulers of Swat.[lower-alpha 1] He thinks it more likely that he was a descendant of Turkish or Persian immigrants to Swat, who had intermarried with local indigenous peoples.[3] It has also been suggested that he belonged to a family which accompanied the sage Mir Sayyid Ali Hamadani, and who were associated to either the Kubrawiya، Sufi groups in Kashmir.[4]