Ceuta was never Moroccan. In fact, Morocco didn't even exist when Ceuta became part of Portugal first (1415) and then Spain (either 1580 or 1640). Ceuta was a part of the Spanish Visigoth kingdom in the 7th Century before the Islamic Conquest (which for some reason we don't call colonisation). Ceuta has always had a strong connection with the rulers of Iberia.
Gibraltar, on the other hand, was just lost in the War of Spanish succession to the British Empire, and has had a British connection to them since then, but never before