Rabat was founded in the 12th century by the Almohad ruler Abd al-Mu'min as a military town. The city steadily grew but went into an extended period of decline following the collapse of the Almohads. In the 17th century Rabat became a haven for Barbary pirates. The French established a protectorate over Morocco in 1912 and made Rabat its administrative center. Morocco achieved independence in 1955 and Rabat became its capital.
The name Rabat comes from الرِّبَاط[ar-ribāṭ] meaning the ribat, an Islamic base or fortification. This name is short for رِبَاط الفَتْح[ribāṭu l-fatħ] meaning the ribat of conquest or stronghold of victory—a title the city acquired in 1170, due to its military importance.