Moorish Gibraltar Moorish Gibraltar was Gibraltar during the period between the landing of the Muslims in Hispania and the fall of the Visigothic Kingdom of Toledo in 711 to the fall of Gibraltar to Christian hands 751 years later , in 1462 , with an interregnum during the early 14th century . The Muslim presence in Gibraltar began on 27 April 711 when the Berber general Tariq ibn - Ziyad led the initial incursion into Iberia in advance of the main Moorish force under the command of Musa ibn Nusayr , Umayyad governor of Ifriqiya . Gibraltar was named after Tariq , who was traditionally said to have landed on the shores of the Rock of Gibraltar , though it seems more likely that he landed somewhere nearby . Muslim sources claimed that Tariq established some kind of fortification on the Rock , but no evidences have been found and it is not considered credible . It was not until 1160 that a first fortified settlement was built there . The " Madinat al - Fath " ( ) was intended to be a major city furnished with palaces and mosques , but it seems to have fallen well short of the ambitions of its founder , the Almohad caliph Abd al - Mu ' min , by the time it was captured by the Kingdom of Castile in 1309 after a short siege . Muslim control was restored in 1333 after another , much longer , siege . The city subsequently underwent a major expansion and refortification . A number of buildings and structures from this period still exist , including the Moorish Castle , parts of the Moorish walls , a bath - house and a subterranean reservoir . Gibraltar was subjected to several more sieges before its final fall on 20 August 1462 ( feast of St . Bernard ) to Christian forces under the 1st Duke of Medina Sidonia . The population , Muslim and Jewish , was expelled " en masse " and replaced by Christian settlers . Early years of Muslim conquest . Gibraltar ' s Islamic history began with the arrival of Tariq ibn - Ziyad on 27 April 711 at the start of the Umayyad conquest of Hispania . Traditionally , Tariq was said to have landed on the shores of the Rock of Gibraltar , which was henceforth named after him ( Jabal - ı Tārıq ( جبل طارق ) , – a name which was later corrupted into " Gibraltar " by the Spanish ) . However , according to one early Islamic account , Tariq " cast anchor " close " to a mountain which received his name " , rather than actually landing " at " Gibraltar . Another account , by the 9th - century Egyptian historian Ibn ' Abd al - Hakam , describes Gibraltar as lying between the points of departure and disembarkation rather than being the actual landing place . According to this account , the possibly legendary Julian , Count of Ceuta – an ally of Tariq who was estranged from Roderic , the Visigothic king of Hispania – transported the Muslim forces in ships which " in no way seemed different from " those which " plied across the Strait for trade . " Spanish accounts corroborate this with the detail that the invasion force was transported " in merchant ships that the reason for their crossing should not be apperceived . " Gibraltar would have been a poor place to land due to its relative isolation and difficult rocky terrain , and it is more likely that Tariq either landed in the vicinity of the former Roman colony of Carteia at the head of the Bay of Gibraltar or on the Alboran coast north of Gibraltar around La Tunara ( now a " barrio " of La Línea de la Concepción in Spain ) , where a landing would have been less conspicuous . It has been argued that some kind of fortification was probably constructed at Gibraltar thereafter . According to the 13th century Kurdish historian Ali ibn al - Athir , Tariq built a fort on The Rock , but this was " only for temporary use , and after he had captured the area of Algeciras , he abandoned it . . . He descended from the mountains to the desert tract and conquered Algeciras and other places , and he abandoned the fort which was in the mountain . " The " fort " probably consisted of no more than a look - out post on the Rock to observe movements in and around the bay during the period of landing ; there would have been little need for anything more substantial ( as better landing points such as Algeciras or Tarifa were in his hands ) , and Tariq would not have had the manpower to construct a sizeable fortification . No mention to a permanent occupation of Gibraltar is found in Arab or Christian chronicles , nor archaeological evidence is found until the 12th century . As the rest of Al - Andalus , Gibraltar was initially part of the territory of the Umayyad Caliphate before passing to the Spanish branch of the Umayyads , which broke away from the main Caliphate after the Abbasid Revolution . Around 1035 , the Umayyad Caliphate of Córdoba splintered into a series of independent " taifa " kingdoms . The Taifa of Algeciras included Gibraltar and managed to maintain its own independence only until 1056 , when it was forcibly absorbed into the Taifa of Seville . By the mid - 1060s Seville faced the threat of invasion from the Almoravids of North Africa . The kingdom ' s ruler , Abbad II al - Mu ' tadid , was conscious that the Almoravids could repeat Tariq ' s feat of three centuries earlier and bring an invasion force across the Strait before the garrison at Algeciras could react . In 1068 he ordered the Governor of Algeciras to " build a fort on Gibraltar , and to be on guard and watch events on the other side of the straits . " However , nothing seems to have been done before the death of Abbad II in 1069 . The Almoravids did come , in 1086 , but at the invitation of the " taifa " kings whose territories were threatened by the expansionist Christian king Alfonso VI of León and Castile . Yusuf ibn Tashfin incorporated the " taifas " into the Almoravid realm in 1090 , but they reemerged 50 years later following the political disintegration of the Almoravid state . The Almoravids ' successors , the Almohads , returned to Spain in 1146 and gained control of the " taifas " once again . Incursions by Alfonso VII of León and Castile and Alfonso I of Aragon into Muslim - held territory in Al - Andalus had shown that the area around Algeciras needed to be more strongly defended . The Almohad caliph Abd al - Mu ' min therefore ordered the construction of a fortified city on Gibraltar , to be called the " Madinat al - Fath " ( the " City of Victory " ) . Madinat al - Fath . Abd al - Mu ' min ' s order , issued on 19 March 1160 , charged two of the most important architects of the day with the task of building Madinat al - Fath . Al - Hajj Ya ' is of Málaga , a renowned mathematician , was assisted by Ahmad ibn Baso , an experienced architect . Abd al - Mu ' min ordered that the city should have a mosque , several palaces for himself and his sons , and reservoirs to provide a supply of water . It was to be protected by a " wall of fine build " with a single gate known as the " Bab al - Fath " ( ) facing towards the isthmus connecting Gibraltar with the mainland . A harbour was also to be constructed , and windmills were to be constructed on the Rock . It is unclear how much of Madinat al - Fath was actually built , since after the death of Abd al - Mu ' min , his son and successor Abu Yaqub Yusuf preferred Seville as his capital . A portion of wall some long still survives to the south of the main part of the city of Gibraltar , of similar design to defensive walls in Morocco . It may have protected a settlement on the upper part of the Rock , around where the modern Queen ' s Road is , but firm archaeological evidence is lacking . In fact , there is no mention of any settlement in Gibraltar either in Arabic or Spanish contemporary sources between the project of Madinat al - Fath and the capture of the town by the Christians in 1309 . The Battle for the Strait . In the late thirteen and early fourteenth centuries , Castile , the Marinid s of Morocco and the Nasrid s of Granada fought for the control of the Strait of Gibraltar . This " battle " ( ) is a major chapter in the history of the Christian reconquest of Spain . It was within this framework of clashes between said powers to bring under control such a strategic area when Gibraltar definitely appeared on the scene . With the implosion of the Almohad Caliphate and the " Reconquista " onslaught of the 1220 – 40s , the north shore of the Strait of Gibraltar came under the jurisdiction of the Nasrid Emirate of Granada , a reduced successor state to al - Andalus . As a dependency of nearby Algeciras , Gibraltar was probably given along with Algeciras in 1274 , by the Nasrid sultan Muhammad II to Abu Yusuf Yaqub , the Marinid sultan of Fez , as payment for his intervention in Spain on Granada ' s behalf against Castilian encroachments . ( other sources mention 1275 as the date when the Sultan of Granada handed over Tarifa , Algeciras and Gibraltar to the Marinids for their use as base ports ) . In 1292 , in his pursuit of controlling the Strait , the troops of Sancho IV of Castile laid siege to Tarifa and easily took it . Under the governorship of Guzmán " el Bueno " , " the Good " , Tarifa was unsuccessfully besieged by the Marinids two years later . As a result , the North African rulers decided to retreated to Magreb and sell their remaining ports to the sultans of Granada . Although no documentary account of Gibraltar is available for the period following the Madinat al - Fath project , there are reasons to believe that a small fortified town existed in Gibraltar , and that its existence was the direct consequence of the fall of Tarifa in 1292 . After the capture of the city , it was expected that Sancho would lay siege to Algeciras ( it did not eventually happen ) in order to sever the most direct links of the Marinids with the Iberian peninsula . The threatening presence of a Christian stronghold to the west would have led to the establishment of a garrison to the east of Algeciras . That way , Gibraltar would have protected the rearguard of Algeciras and provide a fallback position should Algeciras have fallen . At the same time , and with the increased presence of the Christian fleets in the Straits , Gibraltar provided an excellent lookout post . Some years after the events in Tarifa , a quarrel erupted between the Marinids and the Nasrids , in 1306 . The Nasrids promptly sponsored the rebellion of Uthman ibn Idris , a pretender to the Marinid throne in Morocco . Uthman was landed by a Nasrid force in Ceuta , and quickly carved out an enclave . The rebels continued to receive support across the strait from the Nasrid garrisons . It is believed that the Marinid sultan Abu al - Rabi Sulayman , unable to dislodge the rebel from Ceuta , intrigued with the Castilians , whose truce with Granada was about to expire , encouraging them to take Algeciras and Gibraltar and cut the rebel off . The first siege of Gibraltar was a side - operation of the main Castilian siege of Algeciras in 1309 – 10 . The siege was brief . It seems clear that the defences of Madinat al - Fath were lacking as the Castilians succeeded in capturing Gibraltar in 1309 . The Castilian account of the First Siege of Gibraltar indicates that it was only a small place , with " one thousand one hundred and twenty - five Moors " within at the time of its fall . Only two siege engine s and a few hundred men were needed to reduce it . After the conquest and the expulsion of the town ' s population , Ferdinand IV of Castile ordered the defences to be strengthened with the walls repaired , a keep constructed above the town and a dockyard ( " atarazana " ) to be built to house galley s . However , the main siege of Algeciras failed , and the Castilians struck a deal with the Granadan sultan allowing them to hold on to Gibraltar . The loss of Gibraltar led to the deposition of the Nasrid sultan of Granada by his brother Nasr , who quickly reversed policy , abandoned the rebels in Ceuta and gave Algeciras ( and thus the claim on Gibraltar ) to the Marinids in 1310 , as part of a new treaty , hoping they might recover it . But too busy elsewhere for any entanglements in Spain , the Marinids gave Algeciras back to Granada almost immediately after . The Granadans launched an attempt to recover Gibraltar by themselves in 1315 , but without Marinid support , the Second Siege of Gibraltar faltered and failed . The Castilians held Gibraltar for over twenty years , until a new deal was struck in 1333 between the Nasrid sultan Muhammad IV of Granada and the Marinid sultan Abu al - Hasan Ali ibn Othman of Fez . Moroccan forces crossed the strait to Algeciras and began the third siege of Gibraltar in 1333 . This was a much more serious effort , lasting four and a half months , and was mounted by a combined Granadan - Moroccan force . The population of Spanish Christians was reduced to eating their own shoes and belts before the town ' s governor , Vasco Pérez de Meira , surrendered on 17 June 1333 . However , Muhammad IV was assassinated almost immediately after , in a conspiracy organized by enemies of the Marinids in the Granadan court . The Marinid sultan Abu al - Hasan retained both Algeciras and Gibraltar in Moroccan hands . The Castilians immediately mounted an unsuccessful fourth siege which ended after two months . Following the restoration of peace , Abu al - Hasan ordered a refortification of Gibraltar " with strong walls as a halo surrounds the crescent moon " . Many details of the rebuilt city are known due to the work of Abu al - Hasan ' s biographer , Ibn Marzuq , whose " Musnad " ( written around 1370 – 1 ) describes the reconstruction of Gibraltar . The city was expanded , and a new defensive wall was built to cover the western and southern flanks , with towers and connecting passages added to strengthen them . The existing fortifications were also strengthened and repaired . The weak points that the Castilians had exploited were improved . Final century of Moorish Gibraltar . The refortified city – the final incarnation of Moorish Gibraltar – stood in the north - eastern part of the present - day city , reaching from the area of Grand Casemates Square up to Upper Castle Road . It was divided into three main quarters . At the top was the Tower of Homage ( just part of the Moorish Castle but usually referred to as such ) , a formidable square keep situated within a kasbah . The tower had the largest footprint of all the towers to be built in Al - Andalus ( ) . It was a much - strengthened rebuilding of an earlier tower and still bears scars on its eastern wall from projectiles shot by the Castilians during the siege of 1333 . The kasbah could only be accessed via a single gate , which still survives ; an inscription visible up to the 18th century recorded that it had been dedicated to Yusuf I , Sultan of Granada . Below the kasbah was an area later called the " Villa Vieja " ( ) by the Spanish , accessed via the " Bab el - Granada " ( ) , and below that was a port area called " La Barcina " by the Spanish , which may have taken its name from the Galley House ( ) built there by the Moors . It had three separate access gates : the Land Gate ( now the Landport Gate ) , the Sea Gate ( now the Grand Casemates Gates ) and a southern gate , the Barcina Gate . The core of the city was surrounded by substantial defensive walls with tall towers topped by merlon s . Other than the Tower of Homage , two such towers still survive ; one square based which was fitted with a clock in Victorian times and another constructed " en bec " ( beaked , a design intended to resist mining ) . The walls were at first built using tapia , a lime - based mortar made with the local sand and faced with decorative brickwork to simulate masonry . The builders later changed their construction methods to utilise stone interlaced with brick , a rather stronger structure . The southern flank of the walls has survived relatively intact , and vestiges of the other walls are most likely still to be found underlying the modern defensive walls constructed by the British . To the south of the fortified city was an urban area known as the " Turba al Hamra " , literally the " red sands " , named after the predominant colouration of the soil in that area . Ibn Battuta visited the city in 1353 – 4 and wrote : A number of other Moorish remnants are still visible in Gibraltar today . A " hamam " or bath - house , similar to examples in Fez in Morocco , was built in the lower town ; its remnants can still be seen today incorporated into the Gibraltar Museum . It was built using Roman and Visigothic capitals , perhaps salvaged from the nearby ruined city of Carteia . The bath - house may have been part of the Moorish governor ' s house . A mosque was built in the city centre and was later converted by the Spanish into a Catholic church ( now the Cathedral of St . Mary the Crowned ) . A small mosque was built near Europa Point at the southern tip of Gibraltar and was later converted into the Christian Shrine of Our Lady of Europe . A subterranean reservoir , now known as the Nun ' s Well , was also built at Europa Point for the supply of water to the city . An existing 12th - century wall along the sea shore was extended to Europa Point to block access to places where landings could be made by sea . Much of the remainder of Moorish Gibraltar was obliterated by the destruction caused by the Great Siege of Gibraltar in 1779 – 83 and is now buried below the strengthened fortifications and rebuilding implemented by the British afterwards . Fall of the city . The powerful Marinid sultan Abu al - Hasan was severely defeated by the Christian kings at the Battle of Río Salado in 1340 . Marinid Morocco subsequently went into internal convulsions , too busy for active intervention in Spain , clearing the way for a renewed attempt by the Castilians on Algeciras and Gibraltar . Algeciras was taken with relative ease by Alfonso XI of Castile in 1344 . Gibraltar , however , would not fall as easily . The Castilans subjected it to a fifth siege between 1349 – 50 . It ended when Alfonso XI died from bubonic plague during the Black Death . In 1374 control of Gibraltar was transferred from Marinid Fez to Nasrid Granada . In 1410 , however , the Moorish garrison revolted and declared their allegiance to Fez , leading to the sixth siege in 1411 when the Granadan Nasrid s stormed the city with assistance from sympathisers within the walls . Another attempt to capture the city for the Christians was made by Enrique de Guzmán , Second Count of Niebla . The Seventh Siege of Gibraltar ended in disaster on 31 August 1436 when a landing led by Enrique resulted in his drowning at the Red Sands along with 40 knights and men - at - arms . His body was retrieved by the Moors , beheaded and displayed in a wicker basket above Gibraltar ' s Sea Gate for the next 26 years . Finally , on 20 August 1462 , Enrique ' s son Juan Alonso de Guzmán , 1st Duke of Medina Sidonia succeeded in capturing Gibraltar after launching a surprise attack . His success in the brief Eighth Siege of Gibraltar was due to the garrison being greatly depleted after its men of rank had left for Granada , with their retinues , to pay homage to the newly enthroned sultan Abu l - Hasan Ali . An initial assault by the Count of Arcos was beaten back with many casualties on both sides , but the men of the garrison realised that in their depleted state they could not withstand a second assault . They offered to surrender on condition that the garrison and inhabitants of Gibraltar would be allowed to leave with their wives , children and movable goods , with compensation to be paid for the property that they left behind . Although the proposal was welcomed , it fell through due to rivalry between the Christian commanders . The Moorish inhabitants of Gibraltar retreated to the castle and surrendered after a few days to Medina Sidonia . They were expelled along with the city ' s Jewish population , to be replaced by Spanish Christians . The " Reconquista " of Gibraltar took place on the feast of St . Bernard , who the Spanish named patron saint of Gibraltar and has remained so ever since . This brought an end to Moorish Gibraltar , just over 751 years after Tariq ibn - Ziyad had begun the conquest of Iberia .