Before the end of 1399 Timur started a war with Bayezid I, sultan of the Ottoman Empire, and the Mamluk sultan of Egypt. Bayezid began annexing the territory of Turkmen and Muslim rulers in Anatolia. As Timur claimed sovereignty over the Turkmen rulers, they took refuge behind him. Timur invaded Syria, sacked Aleppo, and captured Damascus after defeating the Mamluk army. The city's inhabitants were massacred, except for the artisans who were deported to Samarkand. This led to Timurs being publicly declared an enemy of Islam.