In 1075, ending 700 years of Byzantine rule, Amasya was conquered by the Turkmen Danishmend emirs. It served as their capital until the annexation of the Danishmendid dominions by the Seljuk ruler Kilij Arslan II. When he died, his realm was divided among his sons, and Amasya passed to Nizam ad-Din Arghun Shah. His rule was brief, as he lost it to his brother Rukn ad-Din Suleiman Shah, who subsequently became Sultan. During the 13th century the city passed under the control of the Mongol Ilkhanate, and was ruled by Mongol governors, except for a brief rule by Taj ad-Din Altintash, son of the last Seljuk sultan, Mesud II.