Under the Almohad dynasty Morocco experienced a period of prosperity and brilliance of learning. The Almohad built the Kutubiyya Mosque in Marrakesh, which accommodated no fewer than 25,000 people, but was also famed for its books, manuscripts, libraries and book shops, which gave it its name; the first book bazaar in history. The Almohad Caliph Abu Yakub had a great love for collecting books. He founded a great library, which was eventually carried to the Casbah and turned into a public library.