Following a failed invasion of Iraq in 686, Abd al-Malik focused on securing Syria before making further attempts to conquer the greater part of the Caliphate from his principal rival, the Mecca-based caliph Abd Allah ibn al-Zubayr. To that end, he concluded an unfavorable truce with the reinvigorated Byzantine Empire in 689, quashed a coup attempt in Damascus by his kinsman, al-Ashdaq, the following year, and reincorporated into the army the rebellious Qaysi tribes of the Jazira (Upper Mesopotamia) in 691. He then conquered Zubayrid Iraq and dispatched his general, al-Hajjaj ibn Yusuf, to Mecca where he killed Ibn al-Zubayr in late 692, thereby reuniting the Caliphate under Abd al-Malik's rule. The war with Byzantium resumed, resulting in Umayyad advances into Anatolia and Armenia, the destruction of Carthage and the recapture of Kairouan, the launchpad for the later conquests of western North Africa and the Iberian Peninsula, in 698. In the east, Abd al-Malik's viceroy, al-Hajjaj, firmly established the caliph's authority in Iraq and Khurasan, stamping out opposition by the Kharijites and the Arab tribal nobility by 702. Abd al-Malik's final years were marked by a domestically peaceful and prosperous consolidation of power.