It stretches for almost three thousand kilometres under the Saharan sun, patrolled by military personnel and surrounded by landmines.

The Moroccan Western Sahara Wall is one of the longest separation barriers in the world, by some measurements second only in length to the Great Wall of China and certainly the longest in North Africa.

But its existence has escaped the attention of US President Donald Trump, who suggested, according to Spanish media reports this week, that Madrid should "build a wall" across the Sahara to stop refugees reaching the Spanish mainland.

A Saharawi man holds up a Polisario Front flag near Moroccan soldiers in February 2017 (AFP)

Josep Borrell, Spain's foreign minister, said that Trump made his comments to a Spanish delegation in the US in June, telling him: “The Sahara border can’t be bigger than our border with Mexico.”

That the Moroccan Western Sahara Wall has escaped the attention of Trump, is curious.

The president, a noted fan of separation walls, pledged during his 2016 election campaign that he would build a “big, beautiful border wall,” along the 1,100km border that the United States shares with Mexico. Work on this project has been complicated by funding disputes and opposition in Congress.

What is the 'wall of shame'?

Western Sahara is a former colony of Spain, known in its imperial days as Spanish Sahara. The European nation's presence ended there in 1975, in the last days of dictator General Franco.

The Moroccan Western Sahara Wall was built as a result of the conflict between the Sahrawi people of Western Sahara, who have fought and campaigned for self-determination, and Morocco, which claimed two-thirds of the Spanish Sahara as its own in the Green March of November 1975 and insists its sovereignty cannot be challenged. Spain no longer has any involvement in affairs in the region.

The structure runs for 2,700km, separating Moroccan-occupied regions of the Western Sahara from areas controlled by the Algeria-backed Polisario Front, which wants independence and which won the territory it controls - mostly barely habitable desert - from Mauritania in the war that followed Spain's exit from the region.

To those living near the barrier, which has cut through communities and separated families, it is simply known as the “wall of shame”.

The structure, which consists of six giant sand barriers, or berms, was built between 1980 and 1987. It is guarded by Moroccan troops, and according to the United Nations Mission for the Referendum In Western Sahara (MINURSO) Mine Action project, is strewn with landmines. Residents report that several locals have been killed since the ceasefire reached between Morocco and the Polisario in 1991.

Following that ceasefire, the UN believed it would be able to oversee a referendum on Western Sahara's independence within six months. Nearly three decades later, Sahrawis, who almost all live under repressive conditions in the Moroccan-occupied Western Sahara or in refugee camps in Algeria, are still waiting.

Manuel Devers, the legal adviser to the Polisario Front, told MEE in February: “I want to emphasise, the Western Sahara is not a disputed region, it is a territory that has a border with Morocco. It is not disputed, it is occupied."

Spain: We're not afraid

So will Spain follow Trump's suggestions and build a wall in the Sahara?

An estimated 33,000 people have landed on Spanish shores via the western Mediterranean so far this year, according to the International Organization for Migration - triple the number of arrivals during the same period last year - following a crackdown on the central Mediterranean route between Libya and Italy

But Spain is unlikely to take Trump up on his suggestion.

Borrell, a critic of anti-immigration sentiment in Europe, told Spanish media that he did not support Trump’s idea to build a wall along the US-Mexico border.

Everybody in Europe is being affected by this virus, fears of immigration… This is not the case in Spain

- Josep Borrell, Spanish foreign minister

Trump also seemed unaware of the practical and diplomatic logistics that might face Madrid, should it decide to follow his idea.

The Sahara stretches for some 4,800km, covering parts of 11 countries over which Spain has no jurisdiction, including Morocco, Algeria, Libya, Mauritania, Chad, Egypt, Niger, Sudan, Mali, Eritrea and Tunisia.

Its only regional territories are the two tiny enclaves of Ceuta and Melilla, on the north coast of Africa, surrounded by Morocco. Between them they comprise less than 30 square km and are seen as entry points to Europe by those desperate to reach the continent.