10th century until they were succeeded by the Almohads in the 12th century. The latter introduced some of their own architectural trends, as seen in the Kasbah Mosque of Tunis which bears strong resemblance to Almohad mosque architecture in Marrakesh. The Almohads in Ifriqiya were soon succeeded by the Hafsids, under whose long dominion the center of power and patronage shifted to Tunis and the region's architecture increasingly deviated from that of the western Maghreb and al-Andalus. Madrasas were first built during the Hafsid period and quickly proliferated. After the advent of Ottoman rule in the 16th century some elements and traditions of Ottoman architecture, such as the use of pointed minarets and the creation of multi-functional religious complexes, began to penetrate local architecture, especially among the monuments built by or associated with the new Ottoman elites. Algeria The territory of present-day Algeria was ruled by various dynasties in the early Islamic period, including the Rustamids, the Idrisids (and their Sulaymanid branch), and the Zirids. In the 10th century the Zirids built a palace at 'Ashir (near the present town of Kef Lakhdar) that is one of the oldest palaces in the Maghreb to have been discovered and excavated by archeologists. The Hammadids, an offshoot of the Zirids, based themselves in Algeria and in 1007 they founded an entirely new fortified capital known as Qala'at Bani Hammad, northeast of present-day M'Sila. Although abandoned and destroyed in the 12th century, the city has been excavated by archeologists and the site is one of the best-preserved sites of a medieval capital city in the Islamic world, with remains of multiple palaces and of a monumental mosque. From the late 11th to early 13th centuries varying extents of Algerian territory were controlled by the Almoravids and Almohads. The Great Mosque of Tlemcen (1082), the Great Mosque of Algiers (1096–1097), and the Great Mosque of Nedroma (1145) are all important foundations from the Almoravid period. After the Almohads, the region was mostly controlled by the Zayyanids (13th to early 16th centuries), based in Tlemcen, with occasional incursions by the Marinids. Both the Zayyanids and the Marinids left a significant architectural legacy in Tlemcen, which became a cultural center of the region. Various mosques and monuments in the western Maghrebi-Andalusi style are still preserved in the city today. After the Ottomans brought the region under their control in the 16th century, Algiers became the new