Alania was an important buffer state during the Byzantine-Arab Wars and Khazar-Arab Wars of the 8th century. Theophanes the Confessor left a detailed account of Leo the Isaurian's mission to Alania in the early 8th century. Leo was instructed by Emperor Justinian II to bribe the Alan leader Itaxes into severing his "ancient friendship" with the Kingdom of Abkhazia which had allied itself with Caliph Al-Walid I He crossed the mountain passes and concluded an alliance with the Alans, but was prevented from returning to Byzantium through Abasgia. Although the Abkhazians spared no expense to have him imprisoned, the Alans refused to convey the Byzantine envoy to his enemies. After several months of adventures in the Northern Caucasus, Leo extricated himself from the precarious situation and returned to Constantinople.