The city was fortified by the emperor Zeno in the 5th century, but did not rise to prominence until the 7th century. Its strategic location in central Asia Minor made the city a vital stronghold against the armies of the Umayyad Caliphate following the Muslim conquest of the Levant. The city was first attacked by Muawiyah I in 646. It capitulated to ‘Abd ar-Rahman ibn Khalid in 666 and was occupied by Yazid I in 669, then retaken by Constans II's general Andreas. Over the next two centuries, it remained a frequent target of Muslim raids ("razzias") into Asia Minor, especially during the great sieges of 716 and 796. It became capital of the "thema" of Anatolikon soon after. In 742-743, it was the main base of Emperor Constantine V against the usurper Artabasdos, and in 820, an Amorian, Michael II, ascended the Byzantine throne, establishing the Amorian dynasty. This began the period of the city's greatest prosperity, when it became the largest city in Asia Minor. Its status however as the native city of the reigning dynasty also spelled its doom: in 838, the Caliph Al-Mu'tasim launched a campaign specifically against the city, which was captured and razed, an episode recounted in a poem of Abu Tammam.