York Castle, with its crenellated rampart walls, was situated above the beach on the edge of Tangier.