The Spanish protectorate in Morocco was established on 27 November 1912 by a treaty between France and Spain that converted the Spanish sphere of influence in Morocco into a formal protectorate.
The Spanish protectorate consisted of a northern strip on the Mediterranean and the Strait of Gibraltar, and a southern part of the protectorate around Cape Juby, bordering the Spanish Sahara. The northern zone became part of independent Morocco on 7 April 1956, shortly after France ceded its protectorate. Spain finally ceded its southern zone through the Treaty of Angra de Cintra on 1 April 1958, after the short Ifni War. The city of Tangiers was excluded from the Spanish protectorate and received a special internationally-controlled status as Tangier International Zone.
Since France already held a protectorate over the entire country and had controlled Morocco's foreign affairs since 30 March 1912, it also held the power to delegate a zone to Spanish protection. The surface area of the zone was about 20,948 km², which represents 4.69% of modern-day Morocco.