Fez during this period who was aligned with the Umayyads, wrote to the caliph Abd al-Rahman III in Córdoba for permission and funds to expand the mosque. The caliph approved, and the work was carried out or completed in 956. It expanded the mosque on three sides, encompassing the area of the present-day courtyard to the north and up to the current eastern and western boundaries of the building. It also replaced the original minaret with a new, larger minaret still standing today. Its overall form, with a square shaft, was indicative of the subsequent development of Maghrebi and Andalusian minarets. The mosque was embellished when the Amirid ruler al-Muzaffar (son of al-Mansur) led a military expedition to Fez in 998. The embellishments included a new minbar and a dome topped by talismans in the shape of a rat, a serpent, and a scorpion. Of these, only the dome itself, whose exterior is distinctively fluted or grooved, survives today, located above the courtyard entrance to the prayer hall. A similar dome, located across the courtyard over the northern entrance of the mosque (Bab al-Ward or "Gate of the Rose"), likely also dates from the same time. Almoravid expansion (12th century) One of the most significant expansions and renovations was carried out between 1135 and 1143 under the patronage of the Almoravid ruler Ali ibn Yusuf. The prayer hall was extended by dismantling the existing southern wall and adding three more transverse aisles for a total of ten, while replicating the format of the existing arches of the mosque. This expansion required the purchase and demolition of a number of neighboring houses and structures, including some that were apparently part of the nearby Jewish neighbourhood (before the Mellah of Fez). The new expansion of the mosque involved not only a new mihrab in the middle of the new southern wall, but also the reconstruction or embellishment of the prayer hall's central nave (the arches along its central axis, in a line perpendicular to the southern wall and to the other rows of arches) leading from the courtyard to the mihrab. This involved not only embellishing some of the arches with new forms but also adding a series of highly elaborate cupola ceilings composed in muqarnas (honeycomb or stalactite-like) sculpting and further decorated with intricate reliefs of arabesques and Kufic letters. The craftsmen who worked on this expansion are mostly anonymous, except