sentences:  The Islands were defended by the emperor Charlemagne in 799 from a Muslim pirate incursion.In 848 (maybe 849), four years after the first Viking incursions had sacked the whole island, an attack from Córdoba forced the authorities to ratify the treaty to which the city had submitted in 707.As the city still occupied an eccentric position regarding the commerce network established by the Moors in the western Mediterranean, the enclave was not immediately incorporated into Al-Andalus.