That Rabat is the capital of Morocco is a relatively recent state of affairs. It wasn’t until the arrival of the French in 1912 that the capital was moved away from Fez. Before that, the city was also the capital of a Berber state in the 12th century, when the walls of the Kasbah were built up. The city went into a decline for centuries after the collapse of the state.
This situation in the port city made it ideal as a base for the Barbary Pirates in the 17th century. For almost 200 years, the pirates controlled the city, allowing them to commit acts of piracy and slave tradition up and down the coast. The actions of the pirates even led to the city being shelled by the Austrian Navy in reprisal for an attack on one of their ships.
It’s safe to say the city has since changed quite a bit now. After Moroccan independence in 1955, the city blossomed with explosions in both population and development. A simple walk down Avenue Mohammed V will show you how the city has slowly transformed, with buildings like Parliament and the beautiful Postal Building.