After the death of Caliph Yazid in 683, Ibn al-Zubayr had been recognized as caliph in most of the provinces of the Caliphate, while the Umayyads, who had ruled the Caliphate since the end of the First Islamic Civil War, had been confined to their stronghold of Syria. There, the pro-Umayyad tribes elected Marwan ibn al-Hakam as caliph in 684; after his death in 685, his son and successor Abd al-Malik undertook the task of reasserting Umayyad authority across the Caliphate. After defeating his enemies in Syria and Iraq, he sent his general Hajjaj ibn Yusuf to Mecca to defeat Ibn al-Zubayr.