When Spain relinquished control of the Spanish Sahara in 1975, the territory was divided between Mauritania and Morocco. An independence movement subsequently declared the whole area a sovereign state. In 1979, Mauritania relinquished its claim to part of the country. The Sahrawi government is now formally recognized by many countries and is a full member of the African Union. The government controls about 20% to 25% of the area of the former colony. The remainder is controlled by Morocco. Both Morocco and Sahrawi claim sovereignty over the entire area.
Until 1991 there were no railways. In that year, the Mauritanian mining company SNIM opened a diversion of its main line railway bypassing a tunnel on the original line. About 5km of this diversion lies in the area controlled by the Sahrawi government.
Map image by Vuxi from Wikimedia Commons