The Danishmends took over Malatya one year later in 1101 (see Battle of Melitene). With the Anatolian Seljuk Sultanate based in Konya taking over the Beylik of Danishmend in the late 12th century, Malatya became part of their realm. Under Danishmend and Seljuk rule, Malatya became a centre of knowledge as many Persian and Arabic scholars took residence in the city. The Seljuk Sultanate also undertook an extensive development of the city. After being ruled by the Ilkhanids for around 50 years at the end of the 13th century, the Muslim population of the city invited the Mamluk Sultanate to Malatya in 1315. On 28 April 1315, the Mamluk army entered the city; this was followed by the looting of the city by the army. The Eretna Dynasty gained sovereignty over the city for some time, but from 1338 onwards the Mamluks secured its control. However, for the latter part of the 14th century, the control of the city fluctuated between the Mamluks and the Dulkadirids. The city was captured by the Ottoman army led by Yavuz Sultan Selim on 28 July 1516 and remained under Ottoman rule until the establishment of the Republic of Turkey. Under the Ottomans, the city lost the quality of being on the frontiers, as well as the allure it held in the Middle Ages. It was plagued between the 16th and 18th centuries by successive rebellions.