structural:expansion
Marwanid transition and end of Second Fitna

Umayyad authority nearly collapsed in their Syrian stronghold after the death of Mu'awiya II. Al-Dahhak in Damascus, the Qays tribes in Qinnasrin (northern Syria) and the Jazira, the Judham in Palestine, and the Ansar and South Arabians of Homs all opted to recognize Ibn al-Zubayr. Marwan ibn al-Hakam, the leader of the Umayyads expelled to Syria from Medina, was prepared to submit to Ibn al-Zubayr as well but was persuaded to forward his candidacy for the caliphate by Ibn Ziyad. The latter had been driven out of Iraq and strove to uphold Umayyad rule. During a summit of pro-Umayyad Syrian tribes, namely the Quda'a and their Kindite allies, organized by Ibn Bahdal in the old Ghassanid capital of Jabiya, Marwan was elected caliph in exchange for economic privileges to the loyalist tribes. At the subsequent Battle of Marj Rahit in August 684, Marwan led his tribal allies to a decisive victory against a much larger Qaysite army led by al-Dahhak, who was slain. Not long after, the South Arabians of Homs and the Judham joined the Quda'a to form the tribal confederation of Yaman. Marj Rahit led to the long-running conflict between the Qays and Yaman coalitions. The Qays regrouped in the Euphrates river fortress of Circesium under Zufar ibn al-Harith al-Kilabi and moved to avenge their losses. Although Marwan regained full control of Syria in the months following the battle, the inter-tribal strife undermined the foundation of Umayyad power: the Syrian army.

In 685, Marwan and Ibn Bahdal expelled the Zubayrid governor of Egypt and replaced him with Marwan's son Abd al-Aziz, who would rule the province until his death in 704/05. Another son, Muhammad, was appointed to suppress Zufar's rebellion in the Jazira. Marwan died in April 685 and was succeeded by his eldest son Abd al-Malik. Although Ibn Ziyad attempted to restore the Syrian army of the Sufyanid caliphs, persistent divisions along Qays–Yaman lines contributed to the army's massive rout and Ibn Ziyad's death at the hands of the pro-Alid forces of Mukhtar al-Thaqafi of Kufa at the Battle of Khazir in August 686. The setback delayed Abd al-Malik's attempts to reestablish Umayyad authority in Iraq, while pressures from the Byzantine Empire and raids into Syria by the Byzantines' Mardaite allies compelled him to sign a peace treaty with Byzantium in 689 which substantially increased the Umayyads' annual tribute to the Empire. During his siege of Circesium in 691, Abd al-Malik reconciled with Zufar and the Qays by offering them privileged positions in the Umayyad court and army, signaling a new policy by the caliph and his successors to balance the interests of the Qays and Yaman in the Umayyad state. With his unified army, Abd al-Malik marched against the Zubayrids of Iraq, having already secretly secured the defection of the province's leading tribal chiefs, and defeated Iraq's ruler, Ibn al-Zubayr's brother Mus'ab, at the Battle of Maskin in 691. Afterward, the Umayyad commander al-Hajjaj ibn Yusuf besieged Mecca and killed Ibn al-Zubayr in 692, marking the end of the Second Fitna and the reunification of the caliphate under Abd al-Malik's rule.