Baalbek was occupied by the Muslim army in AD 634 (AH (era) 13), in 636, or under Abu ʿUbaidah following the Byzantine defeat at Yarmouk in 637 (AH (era) 16), either peacefully and by agreement or following a heroic defense and yielding of gold, of silver, 2000 silk vests, and 1000 swords. The ruined temple complex was fortified under the name ( "The Fortress") but was sacked with great violence by the Damascene caliph Marwan II in 748, at which time it was dismantled and largely depopulated. It formed part of the district of Damascus under the Umayyads and Abbasids before being conquered by Fatimid Egypt in 942. In the mid-10th century, it was said to have "gates of palaces sculptured in marble and lofty columns also of marble" and that it was the most "stupendous" and "considerable" location in the whole of Syria. It was sacked and razed by the Byzantines under John I in 974, raided by Basil II in 1000, and occupied by Salih ibn Mirdas, emir of Aleppo, in 1025.