Image caption Rows of curved mirrors capture solar energy

A giant plant using energy from the Sun to power a Moroccan city at night will open next month.

The solar thermal plant at Ouarzazate will harness the Sun's warmth to melt salt, which will hold its heat to power a steam turbine in the evening.

The first phase will generate for three hours after dark; the last stage aims to supply power 20 hours a day.

It is part of Morocco's pledge to get 42% of its electricity generation from renewables by 2020.

The UN has praised Morocco for the level of its ambition. The UK, a much richer country, is aiming for 30% by the same date.

The Saudi-built Ouarzazate solar thermal plant will be one of the world's biggest when it is complete. The mirrors will cover the same area as the country's capital, Rabat.

Futuristic complex

Paddy Padmanathan of Saudi-owned ACWA Power, which is running the thermal project, said: "Whether you are an engineer or not, any passer-by is simply stunned by it.

"You have 35 soccer fields of huge parabolic mirrors pointed to the sky which are moveable so they will track the Sun throughout the day."

The developers say phase one of the futuristic complex will bring energy to a million people.

The complex stands on the edge of a gritty, flat, rust-red desert, with the snow-clad Atlas mountains towering to the North.

It is part of a vision from Morocco's King Mohammed VI to turn his country into a renewable energy powerhouse.

Image caption Melted salt inside this tank holds heat into the evening

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."

It is, he said, a moment in history.

Roger Harrabin visited Morocco for his series Changing Climate on Radio 4 on Monday at 8pm - then on BBC iPlayer. Full interviews for the series are on the Open University's website www.creativeclimate.org.

Follow Roger on Twitter