The Mamluk Sultanate of Egypt was a Muslim dynasty in Egypt (1250–1517). The Mamluks were not Egyptians. They constituted a class of privileged 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 (Çukurova, Cilicia of the antiquity) deteriorated the relations. Furthermore, during Ottoman-Safavid (Persia) war the Dulkadirids which was a Mamluk vassal supported Safavids. After the battle of Chaldiran in 1514, Ottoman vizier (later grand vizier) Hadim Sinan Pasha retaliated by annexing Dulkadirid territory (most of South East Anatolia) to Ottoman realm.The war between the two great powers was inevitable. Ottoman Sultan Selim I (the inflexible) won two decisive battles Battle of Marj Dabiq in 1516 and Battle of Ridaniya in 1517.
After the batte of Ridaniya (23 January 1517) Selim encamped on the island of Vustaniye (or Burac) facing Cairo (at 30°04′N31°13′E / 30.067°N 31.217°E / 30.067; 31.217), the capital. But he didn't enter Cairo. Because Tumanbay II the 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 (Turkish: zafername) to other rulers about the conquest of Cairo. Nevertheless, the leaders of Mamluks were still on the loose. 
Tumanbay escaped from Cairo and tried to organize a new army composed 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.