The country has been 98% dependent on imported fossil fuels, but the king was persuaded of the vast capacity of Atlantic wind, mountain hydro power and scorching Saharan sun.

The king's plans are being enacted by environment minister Hakima el Haite.

She told me: "We are convinced that climate change is an opportunity for our country."

As part of its national commitment to the Paris climate conference, Morocco has pledged to decrease CO2 emissions 32% below business-as-usual by 2030, conditional on aid to reach the renewables target.

Currently Morocco imports electricity from Spain, but engineers hope that will not last long.

Paddy Padmanathan predicted: "If Morocco is able to generate electricity at seven, eight cents per kilowatt - very possible - it will have thousands of megawatts excess.

"It's obvious this country should be able to export into Europe and it will. And it will not need to do anything at all… it needs to do is just sit there because Europe will start to need it."

'True revolution'

Morocco's previously useless slice of the Sahara is proving a blessing for solar power. Solar thermal technology only works in hot sunny countries. The price is falling, and its growing capacity to store energy is arousing interest.

The cost of solar photovoltaic (PV) panels is falling much faster but the International Energy Agency expects them both to play a part in an energy revolution which is likely to see solar as the dominant source of electricity globally by 2050.

Everywhere solar prices are tumbling. Thierry Lepercq, CEO of the Paris-based Solaire Direct, said (controversially) that large-scale ground-mounted solar could already be built without subsidy even in a country like in the UK.

"Solar is a true revolution - that's the way we define it," he said. "The $50 mark (per megawatt hour) is now being crossed and prices are going down.

"The long-term decision-making that is prevalent in the energy world is being disrupted; so you are certainly going to see some coal projects coming to fruition in the next couple of years based on previous decisions but what is certain today is that in all the boards of directors of energy companies, those things are being fundamentally reassessed."