Under the Abbasid caliphs (750-868), governors were appointed for brief periods, and Egypt was plagued by a series of insurrections arising from conflicts between the different sects of Muslims who had settled there: the Sunni, or orthodox majority, and the minority Shia sect. On several occasions the Copts also rose to protest excessive taxation. Such uprisings were met with repression and persecution by the government. Internal conditions became so bad in the late 8th century that a group of new immigrants from Andalusia allied themselves with an Arab tribe and seized Alexandria, holding it until an army arrived from Baghdad and exiled them to Crete. Insurrections continued to break out among the Arabs, who even defeated a governor and burned his baggage. Rebellions by the Copts continued until Caliph Abdullah al-Mamun led a Turkish army to put down the revolts in 832. This was a period of ruthless and unscrupulous governors, who abused the population and extorted money from them. The only bulwark against such oppression lay in the chief qadi, the country's leading Muslim magistrate, who maintained the sacred law—the Sharia—in the face of abuse of power, and helped ease the rapacity of the governors. Despite a predominantly rural population, commercial centers flourished, and Al Fustat grew to become a trading metropolis.From 856 onward Egypt was given as an iqta, a form of fief, to the Turkish military oligarchy that dominated the caliphate in Baghdad. In 868 Ahmad ibn Tulun, a 33-year-old Turk, was sent to the country as governor. A man of ability and education, Tulun ruled wisely and well, but he also turned Egypt into an autonomous province, linked with the Abbasids only by the yearly payment of a small tribute. Tulun built a new city, Al Qita‘ì (“the Wards”), north of Al Fustat. Under his benevolent rule Egypt prospered and expanded to annex Syria. Tulun's dynasty (the Tulunids) ruled for 37 years over an empire that included Egypt, Palestine, and Syria.