Following a raid in 710, a predominantly Berber army under the command of Tariq ibn Ziyad crossed from North Africa in April 711 and landed somewhere in the vicinity of Gibraltar (though most likely not in the bay or at the Rock itself). Tariq’s expedition led to the Islamic conquest of most of the Iberian peninsula. Mons Calpe was renamed Jabal Ṭāriq (جبل طارق), “the Mount of Tariq”, subsequently corrupted into Gibraltar.
In 1160 the Almohad Sultan Abd al-Mu’min ordered that a permanent settlement, including a castle, be built. It received the name of Medinat al-Fath (City of the Victory). The Tower of Homage of the Moorish Castle remains standing today.
After the conquest, Henry IV of Castile assumed the additional title of King of Gibraltar, establishing it as part of the comarca of the Campo Llano de Gibraltar. Six years later, Gibraltar was restored to the Duke of Medina Sidonia, who sold it in 1474 to a group of 4350 conversos (Christian converts from Judaism) from Cordova and Seville and in exchange for maintaining the garrison of the town for two years, after which time they were expelled, returning to their home towns or moving on to other parts of Spain. In 1501 Gibraltar passed back to the Spanish Crown, and Isabella I of Castile issued a Royal Warrant granting Gibraltar the coat of arms that it still uses.
In 1704, during the War of the Spanish Succession, a combined Anglo–Dutch fleet, representing the Grand Alliance, captured the town of Gibraltar on behalf of the Archduke Charles of Austria in his campaign to become King of Spain. Subsequently, most of the population left the town with many settling nearby. As the Alliance’s campaign faltered, the 1713 Treaty of Utrecht was negotiated, which ceded control of Gibraltar to Britain to secure Britain’s withdrawal from the war. Unsuccessful attempts by Spanish monarchs to regain Gibraltar were made with the siege of 1727 and again with the Great Siege of Gibraltar (1779 to 1783), during the American War of Independence.
After the destructive Great Siege, the town was almost entirely rebuilt. Giovanni Maria Boschetti, who arrived in Gibraltar in 1784 as a 25-year-old from Milan, where he is thought to have been a stonemason or engineer, built the Victualling Yard (completed in 1812) and many other buildings. Boschetti is regarded as having been responsible for setting the old town’s style, described by Claire Montado, chief executive of the Gibraltar Heritage Trust, as “military-ordnance-style arched doorways, Italianate stucco relief, Genoese shutters, English Regency ironwork balconies, Spanish stained glass and Georgian sash and casement windows.”
During the Napoleonic Wars, Gibraltar became a key base for the Royal Navy and played an important role leading up to the Battle of Trafalgar (21 October 1805). Designated one of four Imperial fortresses (along with Halifax, Nova Scotia, Bermuda, and Malta), its strategic location made it a key base during the Crimean War of 1854–1856. In the 18th century, the peacetime military garrison fluctuated in numbers from a minimum of 1,100 to a maximum of 5,000. The first half of the 19th century saw a significant increase of population to more than 17,000 in 1860, as people from Britain and all around the Mediterranean – Italian, Portuguese, Maltese, Jewish and French – took up residence in the town.