The name Gibraltar, derives from Jebel Tariq (Tarik's Mountain) and thus owes its name to Tariq ibn Ziyad, one of the leaders of the Moorish conquest of the Iberian Peninsula.
Whilst it seems likely that he used Gibraltar as a beachhead to launch his invasion, there is little evidence that he fortified the Rock to any significant extent.
Nor indeed would there have been much need.
The earliest documentary evidence of substantial buildings on Gibraltar comes after the foundation of the Madinat al-Fath (the City of Victory) by Caliph Abd al-Mumin in 1160. Islamic sources refer to the construction of a mosque (now the site of the Catholic Cathedral of St Mary the Crowned), a palace for the sovereign (possibly incorporating the Moorish Bath House), and defensive walls.
It wasn't until 1309 that the Rock came under serious attack, when it was captured by the Spanish. They held it until 1333 when Abdul Malik, son of the Sultan Abou el Hassan of Morocco, retook it for the Moors.
There then followed a period of intensive building, and most of the surviving remains of the Moorish Castle date from this period. The most prominent of these is the Tower of Homage, a place of last refuge (broadly analogous to a Norman keep).
Towering over old port area, now Casemates Square, it is the highest Moorish tower on the Iberian Peninsula. Much damaged in the subsequent sieges, that it still stands is a testament skills of its builders.
Whilst not much to look at from the outside, the refined and elegant interior detailing is quite different from the rather brutish equivalent found in Norman castles.
Whilst the Tower of Homage is in a fine state of preservation and open to the public as part of the Upper Rock joint ticket scheme, the same cannot be said for the rest of the castle remains.
The Inner and Outer Keep areas (the equivalent of a Norman bailey) were, until September 2010, Gibraltar's Prison.
At the time of my visit, there was still close-boarded fencing along the top of the Tower of Homage preventing people from looking down into the prison, so it was impossible even to see into this area, let alone visit it.
As for the Casbah, this is now the down-market Moorish Castle Estate, and you have to search hard to find the remains of the walls.
One fairly well preserved stretch can be accessed via Upper Castle Road.
This includes a fine tower, and the remains of the old Southern Gatehouse. The later is now part of a car park, with cars actually parked in the old entrance way. Not a good way to treat what may be the oldest building in Gibraltar.