in any case, in the summer of 684, when marwan was elected caliph by pro-umayyad loyalist tribes, chief among them the banu kalb, abd al-aziz was in his father's company. he fought alongside his father and the banu kalb against al-dahhak ibn qays al-fihri and the qaysi tribes, who supported ibn al-zubayr, who had declared himself caliph in 683 and gained widespread recognition in the caliphate, at the battle of marj rahit near damascus in august. abd al-aziz was thrown off his horse during the battle, which ended in a crushing umayyad–kalbite victory. afterward, he played a leading role in marwan's conquest of egypt from its zubayrid governor ibn jahdam al-fihri, serving as the commander of a contingent which crossed into the province through the sinai peninsula, via the red sea port town of ayla. there he confronted ibn jahdam and his deputy zuhayr ibn qays al-balawi, the latter of whom ultimately defected to abd al-aziz. after marwan returned to syria, he designated abd al-malik as his successor, to be followed by abd al-aziz; the former acceded as caliph upon marwan's death in april 685.