The Abbasids swept aside the Umayyad dynasty in a series of revolts in the middle of the 8th century, culminating in the decisive victory at the Battle of Zab in 750 CE. A key ingredient in their success was their ability to unite a disparate set of excluded groups including their Hashimite clan, non-Arab Muslims, Shi’i Arabs and the Persians of Khorasan. Reflecting this support base, the Abbasids pivoted their dominions eastward, founding their new capital at Baghdad, and harnessing a largely Persian bureaucracy. The apogee of the dynasty was reached with caliph Harun al-Rashid (775–809 CE) conducting a series of successful campaigns against the Byzantines both at land and sea. But a civil war followed his death, separatism occurred both in the far east and west. A rump Umayyad dynasty survived, centred on Spain, and Saffarids from Khorasan almost captured Baghdad in 876 CE.