The first capital of the Fatimids c 902, who later conquered Egypt (969) and thereafter ruled from Cairo. Mahdiya occupied a narrow peninsula with a double wall and a single imposing entrance, the Sqifa al-Kahla. The other important Fatimid monument is the Mosque of Obeid Allah, built c 912, with a monumental entrance, a courtyard with single arcades on all four sides, and a sanctuary with a T-shaped arrangement of nave and transepts. Its plan anticipates the Fatimid mosque at Ajdabiyah and the mosques of Cairo. Other Fatimid buildings at Mahdiya include part of the palace of Obeid Allah and a naval dockyard.