In 1454, Diego Garcia De Herrera, the Governor of Lanzarote (Canary Islands) arrived on the Moroccan coasts and ordered to build a small fortress which he called "Santa Cruz de Mar Pequena" (Holy Cross of the Small Sea). Its purpose was to protect the Canary Islands against the pirates and to establish a commercial center for fishery.
In 1524, the fortress was destroyed by the local population. This did not prevent the Spanish to claim rights with the Moroccan Sultans. Three treaties were signed with Morocco to perpetually concede the Territory of "Santa Cruz" and later called Ifni to Spain (1767 in Marrakech, 1799 in Meknes and 1860 in Tetouan).
The treaty of Tetuan was based on two treaties between the French and the Spanish (in 1904 and 1912) outlining the borders of the enclave. These borders were discussed and negotiated at great length. It was impossible to agree on the exact and real location of Santa Cruz. The region of Ait Baamrane was selected and the territory was finally conceded to Spain.
The Spanish occupation became effective on April 6, 1934 when Colonel Capaz arrived under the authority of the Spanish governor, the population was then considered as Spanish citizens. A lot of money was invested by Spain to establish a proper infrastructure. Even an artificial port with a special transportation lifting system was built providing a link to the Canary Islands. This enabled ships to load/unload cargo which would have been otherwise impossible in the rough waters of the Atlantic.
Ifni mainly served the Spanish as a military base to protect the Canary Islands and to develop fisheries. Stamps were printed, roads and official buildings constructed, health services and schools were established. The territory later became a full Spanish Province in 1960.
From 1957 onwards, many military incidents occured between the Spanish Army and the Moroccan Liberation Army which reduced the borders of the enclave. First, His Majesty Mohamed V, then followed by His Majesty Hassan II reclaim all the territories from Franco occupied by Spain, of which Ifni was one of them.
The negotiations, which lasted from 1963 to 1968, concluded in Spain signing a treaty with Morocco on January 4, 1969 in Fes to withdraw from Ifni. This coincided with Spain agreeing on major fishing rights in Morocco.
The citizens of Ifni had three months to choose their nationality. Morocco further granted property rights to Spain regarding many of its major buildings in Sidi Ifni including the Consulate and the Church. The Inpendence Day from Spain took place on June 30, 1969, when the Spanish military and civil population fully withdrew from the territory. Only one Spanish lady, called Maria, chose to stay to spend the rest of her life in Sidi Ifni.