The fortifications on and around the site of the Moorish Castle were first built in 1160, or earlier. These were, however, destroyed when the Spanish re-conquered Gibraltar from 1309-1333. The Tower of Homage, its main feature, dominates the hillside and the landward approach to Gibraltar. A rebuilt tower dates primarily from about 1333 AD when Abu'l Hassan recaptured Gibraltar from the Spanish. On another occasion, the Count of Niebla attacked the castle, was captured by the Medieval defenders and his body was suspended from the walls in a barcina, a net for carrying straw.
The Tower of Homage proudly displays the battle scars inflicted during the various sieges. Here a Spanish governor held out for five months against the Duke of Medina Sidonia, who took Gibraltar from his own sovereign, Queen Isabel of Spain. In 1540, hundreds of people found safety inside the castle when Turkish pirates ransacked Gibraltar. The lower castle formerly stretched all the way down to Casemates Square, the Grand Battery area and the Old Mole. It is interesting to note that the courtyard of the Moorish Castle served as a prison up until 2010.