An Abbasid–Carolingian alliance was attempted and partially formed during the 8th to 9th century through a series of embassies, rapprochements and combined military operations between the Frankish Carolingian Empire and the Abbasid Caliphate and pro-Abbasid rulers in Al Andalus (Islamic Spain and Portugal).
These contacts followed the intense conflict between the Carolingians and the Umayyads of Al Andalus, marked by the Battle of Tours in 732, and were aimed at establishing a counter-alliance with the 'faraway' Abbasid Empire based in the Near East. Slightly later, another Carolingian-Abbasid alliance was attempted in a conflict against the Eastern Roman Empire (Byzantine Empire).
The Umayyad invasion of Gaul from 719 to 759 was a period of intense conflict between the Carolingians and the Umayyads, marked by the Battle of Tours in 732. Umayyad forces were finally expelled from Gaul with the recovery of Narbonne in 759 by Pepin the Short, but the Umayyad presence in Spain continued to represent a strong threat to the Carolingians.
Contacts between the Carolingians and the Abbasids started soon after the establishment of the Abbasid Caliphate and the concommital fall of the Umayyad Caliphate in 751. The Carolingian ruler Pepin the Short had a powerful enough position in Europe to "make his alliance valuable to the Abbasid caliph of Baghdad, al-Mansur". Former supporters of the Umayyad Caliphate were established firmly in southern Spain under Abd ar-Rahman I, and constituted a strategic threat both to the Carolingian on their southern border, and to the Abbasid at the western end of their dominion.