Immediately before the decline of the Ayyubid State, the Mamelukes controlled most of the important posts in Egypt. After the murdering of Turanshah (the last of the Ayyubid Sultans), Shajart El-Durr (wife of King Al-Saleh Ayyub) married Aybak who was one of the Bahari Mamelukes chiefs. By the assassination of Aybak in 1257, the Mamelukes had already established themselves in Egypt and were able to establish their own empire because the Mongols destroyed the Abbasid Caliphate. In 1258, the Mongol invaders put to death the last Abbasid caliph in Baghdad. In the following year, a 120,000-man Mongol army, commanded by Hulagu Khan, crossed the Euphrates and entered Syria. Meanwhile, in Egypt, the last Ayyubid sultan had died in 1250, and political control of the state had passed to the Mameluke guards whose generals seized the sultanate.
The word ' Mameluke' means 'Owned' and it was given to the white male slaves, captured in war or bought in the markets. El-Aziz, the Fatimid Caliph was the first one to introduce Turkish Mamelukes into the army of Egypt. Their numbers increased more and more under the Ayyubid Dynasty, especially, in the reign of El-Malik-Es-Saleh, who brought more than 1000 Mamelukes from Western Asia. Then, they formed a private army that stayed at the Castle, which El-Malik built on the Island of Roda, on the Nile. For that reason, they had the name 'Bahari (River) Mamelukes'.