Located on an Atlantic coast at the mouth of the river Bou Regreg, the city of Rabat was founded in 1146 as a military base of the Almohad Empire. The third Almohad caliph, Yaqub al-Mansur, built the kasbah, as well as the Hassan Tower and the city walls. After his death the empire started to collapse, and Rabat was all but abandoned.
In the 17th century, Spain expelled a large number of Moriscos, or descendants of Muslims who were forced to convert to Christianity. Some of them made their way to Rabat and settled in the city, and some of that group turned to piracy and slave trade, mainly preying on Spanish vessels and offering a tenth of their loot to the king of Morocco.
Eventually the Moorish corsairs decided to rebel against the crown. In 1624, together with the Salé Rovers from the opposite side of the Bou Regreg, led by the Dutch pirate Jan Janszoon, they declared Rabat an autonomous state known as the Republic of Salé or the Corsair Republic.
The republic lasted for 44 years, until the Sultan Al-Rashid of the Alaouite dynasty (which still rules Morocco to this day) seized Rabat and Salé and held them under his control, uniting the kingdom. But that doesn’t mean it got rid of the Barbary pirates; they continued to use the port of Rabat and remained active to the early 19th century, well after the Golden Age of Piracy had ended.
The Kasbah of the Udayas served as an important center of the Republic of Salé. Many renovations were made during its time, including platforms, fortifications and a round tower overlooking the Bou Regreg, which was known as the Corsairs’ Tower. A royal pavilion was built under the reign of Alaouite sultan Moulay Ismail, who is responsible for the settling of the Udaya Arab tribe in Rabat.
Today, the kasbah, along with the adjacent medina, is a popular attraction in Rabat. It contains a mosque, a large museum (housed in Moulay Ismail’s pavilion), Andalusian Gardens and a residential neighborhood, known for its stunning blue and white walls. In 2012, it was granted the status of World Heritage Site by UNESCO.