Shāh Mīr arrived in Kashmir in 1313, along with his family, during the reign of Sūhadeva (1301–20), whose service he entered. In subsequent years, through his tact and ability, Shāh Mīr rose to prominence and became one of the important personalities of the time. Later, after the death in 1338 of Udayanadeva, the brother of Sūhadeva, he was able to assume the kingship himself and thus laid the foundation of permanent Muslim rule in Kashmir. Dissensions among the ruling classes and foreign invasions were the two main factors which contributed towards the establishment of Muslim rule in Kashmir.