Qayrawan the first Islamic city of north-west Africa was chosen as his headquarters by Uqba ibn Nafi in 671 when he began the Muslim conquest of the Maghreb. Uqba’s first mosque was rebuilt more than once. The present Great Mosque which was begun in 836 is notably a defensive structure with thick walls enclosing a large courtyard. The massive crenelated minaret that stands in the middle of the north side of the mosque has a clear military character.