12th to 17th century
Rabat has a relatively modern history compared to the ancient city of Salé. In 1146, the Almohad ruler Abd al-Mu'min turned Rabat's ribat into a full scale fortress to use as a launching point for attacks on Spain. In 1170, due to its military importance, Rabat acquired the title Ribatu l-Fath, meaning "stronghold of victory," from which it derives its current name.
Yaqub al-Mansur (known as Moulay Yacoub in Morocco), another Almohad Caliph, moved the capital of his empire to Rabat. He built Rabat's city walls, the Kasbah of the Udayas and began construction on what would have been the world's largest mosque. However, Yaqub died and construction stopped. The ruins of the unfinished mosque, along with the Hassan Tower, still stand today.
Yaqub's death initiated a period of decline. The Almohad empire lost control of its possessions in Spain and much of its African territory, eventually leading to its total collapse. In the 13th century, much of Rabat's economic power shifted to Fez. In 1515 a Moorish explorer, El Wassan, reported that Rabat had declined so much that only 100 inhabited houses remained. An influx of Moriscos, who had been expelled from Spain, in the early 17th century helped boost Rabat's growth.
Corsair republics
Rabat and neighboring Salé united to form the Republic of Bou Regreg in 1627. The republic was run by Barbary pirates who used the two cities as base ports for launching attacks on shipping. The pirates did not have to contend with any central authority until the Alaouite Dynasty united Morocco in 1666. The latter attempted to establish control over the pirates, but failed. European and Muslim authorities continued to attempt to control the pirates over many years, but the Republic of Bou Regreg did not collapse until 1818. Even after the republic's collapse, pirates continued to use the port of Rabat, which led to the shelling of the city by Austria in 1829 after an Austrian ship had been lost to a pirate attack.
20th century
French invasion
The French invaded Morocco in 1912 and established a protectorate. The French administrator of Morocco, General Hubert Lyautey, decided to relocate the country's capital from Fez to Rabat. Among other factors, rebellious citizens had made Fez an unstable place. Sultan Moulay Youssef followed the decision of the French and moved his residence to Rabat. In 1913, Gen. Lyautey hired Henri Prost who designed the Ville Nouvelle (Rabat's modern quarter) as an administrative sector. When Morocco achieved independence in 1956, Mohammed V, the then King of Morocco, chose to have the capital remain at Rabat.
Post World War II
Following World War II, the United States established a military presence in Rabat at the former French air base. By the early 1950s, Rabat Salé Air Base was a U.S. Air Force installation hosting the 17th Air Force and the 5th Air Division, which oversaw forward basing for Strategic Air Command (SAC) B-47 Stratojet aircraft in the country. With the destabilization of French government in Morocco, and Moroccan independence in 1956, the government of Mohammed V wanted the U.S. Air Force to pull out of the SAC bases in Morocco, insisting on such action after American intervention in Lebanon in 1958. The United States agreed to leave as of December 1959, and was fully out of Morocco by 1963. SAC felt the Moroccan bases were much less critical with the long range capability of the B-52 Stratofortresses that were replacing the B-47s and with the completion of the USAF installations in Spain in 1959.
With the USAF withdrawal from Rabat-Salé in the 1960s, the facility became a primary facility for the Royal Moroccan Air Force known as Air Base Nº 1, a status it continues to hold.