The Almohad caliph Yaqub al-Mansur founded Rabat in the late 12th century as an ambitious military capital, beginning construction of what he intended to be the largest mosque in the Islamic world. His death left the project unfinished, leaving behind only the celebrated Hassan Tower as a monument to the unrealised plan.

Alongside the Hassan Tower and the Mausoleum of Mohammed V — together a UNESCO World Heritage Site — Rabat is home to the Kasbah of the Udayas, a 12th-century fortress overlooking the ocean with narrow lanes painted blue and white.