The history of Western Sahara can be traced back to the times of Carthaginian explorer Hanno the Navigator in the 5th century BC. Though few historical records are left from that period, Western Sahara's modern history has its roots linked to some nomadic groups (living under Berber tribal rule and in contact with the Roman Empire) such as the Sanhaja group and the introduction of Islam and the Arabic language the end from the 8th century AD.
The Western Sahara has never been a nation in the modern sense of the word. It was home to Phoenician colonies, but those disappeared with virtually no trace. Islam arrived in the region in the 8th century, but the region, beset with desertification, remained little developed. From the 11th to the 19th centuries, Western Sahara was one of the links between Sub-Sahara and North Africa regions. During the 11th century, the Sanhaja tribal confederation allied with the Lamtuna tribe to found the Almoravid dynasty. The conquests of the Almoravids extended over present-day Morocco, Western Algeria and the Iberian peninsula to the north and Mauritania and Mali to the south reaching the Ghana Empire. By the 16th century, the Arab Saadi dynasty conquered the Songhai Empire based on the Niger River. Some Trans-Saharan trade routes also traversed Western Sahara.
In 1884, Spain claimed a protectorate over the coast from Cape Bojador to Cape Blanc, and the area was later extended. In 1958 Spain combined separate districts together to form the province of Spanish Sahara.
A 1975 advisory opinion by the International Court of Justice on the status of the Western Sahara held that while some of the region's tribes had historical ties to Morocco, they were insufficient to establish "any tie of territorial sovereignty" between the Western Sahara and the Kingdom of Morocco. In November of that year, the Green March into Western Sahara began when 300,000 unarmed Moroccans accompanied by the Moroccan Army armed with heavy weapons converged on the southern city of Tarfaya and waited for a signal from King Hassan II of Morocco to cross into Western Sahara. As a result of pressure from France, the US and the UK, Spain abandoned Western Sahara on November 14, 1975, going so far as to even exhume Spanish corpses from cemeteries. Morocco later virtually annexed the northern two-thirds of Western Sahara in 1976, and the rest of the territory in 1979, following Mauritania's withdrawal.
On February 27, 1976, the Polisario Front formally proclaimed the Sahrawi Arab Democratic Republic and set up a government in exile, initiating a guerrilla war between the Polisario and Morocco, which continued until a 1991 cease-fire. As part of the 1991 peace accords, a referendum was to be held among indigenous people, giving them the option between independence or inclusion to Morocco. To date the referendum has not been held because of questions over who is eligible to vote.