The Tangier International Zone (منطقة طنجة الدولية Minṭaqat Ṭanja ad-Dawliyya, Zone internationale de Tanger, Zona Internacional de Tánger) was a international zone centered on the city of Tangier, Morocco, which existed from 1925 until its reintegration into independent Morocco in 1956, with interruption during the Spanish occupation of Tangier (1940–1945), and special economic status extended until early 1960. Surrounded on the land side by the Spanish protectorate in Morocco, it was governed under a unique and complex system that involved various European nations, the United States (mainly after 1945), and the Sultan of Morocco, himself under a French protectorate. For nearly a century after the end of English rule in 1684, Tangier was primarily a military town, the main fortified outpost on the Moroccan Sultanate's side of the Strait of Gibraltar. This role evolved after Sultan Mohammed ben Abdallah designated it in 1777 as the main point of contact between the Moroccan monarchy and European commercial interests, leading to the gradual relocation of a number of consulates to the city by the main European nations. Great Britain, an ally of the Sultanate since 1713 as it needed Moroccan help to provision Gibraltar, moved its consul from Tétouan to Tangier in the 1770s, and the consul of France similarly moved in from Rabat in the early 1780s. By 1830, Denmark, France, Portugal, Sardinia, Spain, Sweden, Tuscany, the United Kingdom, and the United States all had consulates in Tangier. In 1851, the sultan appointed a permanent representative to the foreign powers in Tangier, the Naib, and in 1856, all remaining consulates were elevated to legations. Since the Moroccan legal regime applied Islamic law only to Muslims and Judaic law only to Jews, foreign representatives were kept under a derogatory legal status defined by successive bilateral agreements with the Makhzen, the oldest of which appears to have been concluded with the Republic of Pisa in 1358.