يوسف بن تاشفين
In 1069–1070 (or possibly a few years later), Fez was conquered by the Almoravids under Yusuf ibn Tashfin. In the same year of this conquest, Yusuf ibn Tashfin finally unified "Madinat Fas" and "Al-'Aliya" into one city. The walls dividing them were destroyed, bridges connecting them were built or renovated, and a new circuit of walls was constructed that encompassed both cities. A kasbah (citadel) was built at the western edge of the city (just west of Bab Bou Jeloud today) to house the city's governor and garrison. Under Almoravid patronage the largest expansion and renovation of the Great Mosque of al-Qarawiyyin took place (1135–1143). Although the capital was moved to Marrakesh under the Almoravids, Fez acquired a reputation for Maliki legal scholarship and remained an important centre of trade and industry. Almoravid impact on the city's structure was such that Yusuf ibn Tashfin is sometimes considered to be the second founder of Fez.