The Ribat of Monastir, located in Monastir, Tunisia was actually a fortress. It was also the first of its kind built on the North-African coastline. The Ribat was started at the end of the 8th century and wasn't really completed until the 10th century. It took so long due to battle skirmishes destroying it. Each time it was rebuild it got extended and grew over the centuries. The Ribat of Monastir was built right on top of the foundations of a Byzantine monastery that by all accounts gave its name to the town.
You'll notice the watchtower or nador that is considered to be the oldest part of the fortress. It's accessible and you can catch a great view of the whole town when you go to take pictures. Interesting note: this fortress was used as a background setting for Monty Pythons The Life of Brian and also for Jesus of Nazareth. The Ribat incorporates the Kasbah and an Islamic museum.