On May 28, 1767, Mohammed ben Abdallah, the Sultan of Morocco, signed a peace and commerce treaty with King Charles III of Spain. In the treaty, Morocco was unable to guarantee the security of Spanish fishermen along the coasts south of the Noun River, as Morocco did not have control over the Tekna tribes of that area. On March 1, 1799, Sultan Slimane signed an accord with King Charles IV of Spain, in which he recognized that the Saguia el Hamra and Cape Juby regions were not part of his dominions. In 1879, the British North West African Company established a trading post near Cape Juby called "Port Victoria". On March 26, 1888, Moroccan soldiers attacked the post, killing the director of the post and leaving two workers badly injured. In 1895, the company sold its post to the Sultan of Morocco.
Spanish protectorate
In 1912, Spain negotiated with France for concessions on the southern coast of Morocco. officially occupied the Cape Juby region for Spain on July 29, 1916. It was administered by Spain as a single entity with Spanish Sahara and the Ifni enclave, as Spanish West Africa. The Spanish area comprised and had a population of 9,836. Its main town was founded by the Spanish as Villa Bens. Villa Bens was used as a staging post for airmail flights.
Retrocession to Morocco
When Morocco became independent in 1956, it requested the cession of Moroccan areas controlled by Spain. After some resistance and some fighting during 1957, the Spanish government in 1958 ceded the Cape Juby Strip to Morocco.
Sahara sea
In 1877, the Scottish engineer Donald Mackenzie was the first to propose the creation of a Sahara Sea. Mackenzie's idea was to cut a channel from one of the sand-barred lagoons north of Cape Juby south to a large plain which Arab traders had identified to him as El Djouf. Mackenzie believed this vast region was up to below sea level and that flooding it would create an inland sea of suited to commercial navigation and even agriculture. He further believed that geological evidence suggested this basin had once been connected to the Atlantic via a channel near the Saguia el-Hamra. He proposed that this inland sea, if augmented with a canal, could provide access to the Niger River and the markets and rich resources of West Africa. There are several small depressions in the vicinity of Cape Juby; at 55 m below sea level, the Sebkha Tah is the lowest and largest. But it covers less than 250 km² and is 500 km north of the geographical area identified as El Djouf which has an average elevation of 320 m. Mackenzie never travelled in this area but had read of other sub-sea level desert basins in present-day Tunisia, Algeria and Egypt similar to those found near Cape Juby. These basins contain seasonally dry salt lakes, known as chotts or sebkhas. Egypt's Qattara Depression is perhaps the largest such basin in North Africa.