The Mamluk Sultanate of Egypt was a Muslim dynasty in Egypt. The Mamluks constituted a class of military slaves of either Turkic or Circassian origin. After a coup in 1250 they began ruling in Egypt and they annexed Syria and Palestine to their realm. Initially the relations between Mamluk Sultanate and the Ottoman Empire in Turkey and Balkans were friendly. But during the last years of the 15th century, the competition to control south Turkey deteriorated the relations. Furthermore, during Ottoman-Safavid war the Dulkadirids, which was a Mamluk vassal, supported Safavids. After the Battle of Chaldiran in 1514, Ottoman vizier Hadim Sinan Pasha retaliated by annexing Dulkadirid territory after the Battle of Turnadag to the Ottoman realm in 1515. The war between the two great powers was inevitable. Ottoman Sultan Selim I won two decisive battles Battle of Marj Dabiq in 1516 and Battle of Ridaniya in 1517.
Conquest of Cairo
After the battle of Ridaniya Selim encamped on the island of Vustaniye facing Cairo, the capital. But he didn't enter Cairo. Because Tumanbay IIthe sultan of Mamluks as well as Kayıtbay another leader of Mamluks had managed to escape and Selim decided to concentrate on arresting the leaders before entering Cairo. Thus he sent only a vanguard regiment to Cairo on 26 January. Although the regiment was able to enter the capital without much fighting, the same night Tumanbay also secretly came to the capital. With the help of Cairo citizens he raided the Ottoman forces in the capital and began controlling Cairo. After hearing the news of Tumanbay's presence in Cairo, Selim sent his elite troops to the city. After several days' fighting the Ottoman forces entered the city on 3 February 1517. Selim entered the city and sent messages to other rulers about the conquest of Cairo. Nevertheless, the leaders of Mamluks were still on the loose.
Aftermath
Tumanbay escaped from Cairo and tried to organize a new armycomposed of Egyptians together with what was left out of the Mamluk army. His army was no match for the Ottoman army. But he was planning to raid Selim's camp on Vustatiye island. However Selim heard about his plan and sent a force on Tumanbay to forestall his plans. After some small scale clashes Tumanbay was arrested on 26 March 1517. Selim's initial decision was to send Mamluk notables to İstanbul. But after a while, he changed his decision. Tumanbay and the other notable Mamluks were executed on 13 April 1517 by a former Mamluk commander who had switched sides.