Morocco controlled the trans-Saharan trade routes for most of the period between the 8th and 17th centuries, and that control is the single most important explanation for why the country has the palaces, medersas, and imperial cities it does. The Sahara was not an obstacle. It was the highway — and Morocco owned the northern toll gate.
The basic system was simple: gold came north, salt went south, and the Moroccan dynasties that taxed the exchange grew extraordinarily rich. The Saadian Sultan Ahmad al-Mansur earned the epithet al-Dhahabi — the Golden — not because he was metaphorically successful, but because gold literally flowed through his treasury in Marrakech. He used it to build the El Badi Palace with Italian marble purchased from Genoa at a rate of sugar for marble, weight for weight. That is what Saharan trade money looked like in the 1580s.
If you are travelling to the Moroccan south — driving through the Draa Valley, stopping at a kasbah in Ouarzazate, or riding a camel into the Erg Chebbi dunes near Merzouga — you are retracing, in comfort and in reverse, the path those caravans made across the same landscape for eight hundred years.