After having troubles with the Khwarezmians, the Muslim Sultan Al-Salih then began ordering armed expeditions to raid into Christian communities and capture men, women and children. Called razzias, or by their original Arabic name Ghazw (sing.: ghazwa or ghaza), the raids extended into Caucasia, the Black Sea, Byzantium, and the coastal areas of Europe. The newly enslaved were divided according to category. Women were either turned into maids or sex slaves. The men depending upon age and ability were made into servants or killed. Young boys and girls were sent to Imams where they were indoctrinated into Islam. According to ability the young boys were then made into eunuchs or sent into decades long training as slave soldiers for the sultan. Called Mamluks, this army of indoctrinated slaves were forged into a potent armed force. The Sultan then used his new Mamluk army to eliminate the Khwarezmians, and Jerusalem returned to Egyptian Ayyubid rule in 1247.