In a small village, deep in the High Atlas mountains, lie the remains of a medieval Almohad fortress that once was the capital of a vast empire stretching from Mali to Tunisia and Spain.

The city of Tin Mal was established by Ibn Tumart, the founder and mahdi (spiritual leader) of the Almohads, around 1124, and was the cultural and religious center of the empire until the city’s destruction by the rival Merinid dynasty in the 1270s. All that was spared, apart from a few fragments of wall, was the monumental mosque constructed in 1156 in honor of Ibn Tumart, according to official Almohad doctrine.

The mosque was abandoned for many years, but restored in the 1990s. It stands prominently on a hill overlooking the rural village that Tin Mal (also called Tinmel) has become today. Unlike most Almohad mosques, non-Muslims are allowed inside, although you may have to phone the guard to open the door.

The interior is remarkably well-preserved, with an elaborate mihrab (the niche in the wall that faces Mecca, indicating the direction of prayer) and vaulted pillars. The mosque is unique in having its minaret above the mihrab rather than in a separate tower, giving it a castle-like appearance from the outside.