 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.