The Abbasids took power from the Umayyads in 750 and founded Baghdad in 762. In 751 their army defeated a Tang force at the
怛罗斯之战 Battle of Talas. Tang sources called them
黑衣大食 'the black-robed Arabs', after their black banners and dress. The caliphate ended when the Mongols sacked Baghdad in 1258.