The Moroccan city of Ouarzazate sits on a dusty, red-earth plateau where the Atlas Mountains begin to descend into the Sahara Desert. Its dramatic landscape has made it a popular setting for movies and TV shows, from Middle Eastern epics like “Lawrence of Arabia” and “The Mummy” to HBO’s “Game of Thrones.”

But Ouarzazate’s location also makes it a perfect spot for a different kind of outsized production: Morocco hopes to get more than half of its energy from renewable sources in less than 15 years. This part of the country is one of the sunniest places on Earth, so it was a natural site for a sprawling complex of solar power plants named Noor, the Arabic word for "light."

From a sleek new observation tower, you can see rows of gleaming, 20-foot-long curved mirrors stretching out in every direction across the barren plateau — about 500,000 in all.

The curved mirrors concentrate the sunlight like lenses, focusing a huge amount of heat onto long rows of metal pipes filled with molten salts, heating the liquid up to more than 700 degrees. That heat is then used to boil water, make steam and spin turbines, just like a regular power plant.

The technology is called concentrated solar power, or CSP, and as with the photovoltaic panels of more conventional solar power plants, the mirrors here follow the movement of the sun, from its rise over the desert in the east to sunset over the mountains to the west.

The concentrated solar power (CSP) technology at Morocco's Noor plant uses thousands of curved mirrors like these to focus the sun's heat on tubes carrying a molten salt solution, heating the liquid up to roughly 700 degrees Fahrenheit. That heat is then used to generate electricity. When it's completed, the Noor plant will be among the largest solar power plants in the world. Credit: Youssef Boudlal

But what sets this technology apart is that the power can stay on even after the sun has gone down.

“After the sunset, the hot salt is giving back the thermal energy to the heat transfer fluid, and it goes to produce steam during the night,” says Youssef Stitou, a senior project engineer for Morocco’s renewable energy agency, or MASEN.

The ability to store some of the sun’s energy for up to three hours after sundown addresses a common criticism of solar energy: that it's useless when the sun doesn’t shine.

CSP is hardly a new idea — the first CSP plant was built in California more than 30 years ago — but the concept is starting to get a lot more traction. And it’s potentially transformational for countries like Morocco that have huge renewable energy resources.

Related: Muslim environmentalists give their religion — and their mosques — a fresh coat of green

Related: Donald Trump sees the future in coal. China sees the future in renewables. Who’s making the safer bet?

Many countries are investing in renewable energy, but few are doing so as aggressively as Morocco. The first phase of the plant, Noor 1, started generating power in 2016, and by 2018, it could become the largest plant of its kind in the world.

But CSP is also expensive. Just the first phase of this three-part project cost nearly a billion dollars. And it could be a risky investment, according to some renewable energy experts.

“Whether they bet on the right technology, they will find out in the years to come,” says Christian Breyer, a professor of solar economy at Lappeenranta University of Technology in Finland.

Morocco is pumping up its solar capacity fast, but Breyer says it might not be fast enough to keep up with the speed of innovation in the industry. Photovoltaic panels and batteries to store their output have improved so quickly that they threaten to outshine concentrated solar plants like Noor.

“From that point of view, we will see a race between these two technologies,” says Breyer. “It’s really the question how to get the technology cost-competitive, and for that, they have to grow very fast.”

Morocco is hoping its huge investments in Noor will help bring down prices for concentrated solar technology around the world. But the country is running another kind of energy race, too. Twenty years ago, only about half of Moroccans had electricity. Now, almost everybody does. And the country’s population and economy are growing fast.

“Everyone starts to have his own smartphone, PC, laptop, TV,” says Samir Rachidi, a project manager at MASEN.

Rachidi says if Morocco doesn’t aggressively develop renewable energy, “then our economic growth would be in hostage of foreign fossil fuel.”

Morocco still gets most of its energy from imported fossil fuels, but with so much sun and wind, King Mohammed VI has declared that by 2030 more than half of the country’s energy should come from renewable sources. The king also promised to tamp down demand by making the country 20 percent more energy efficient.

The government is hoping the Noor plant will help it meet those goals. It’s also hoping the project will help kick-start a domestic renewable energy industry that could one day be able to sell cheap renewable electricity to its neighbors. Morocco has more than two dozen renewable energy projects in operation or development. (Click for an interactive version of the map.) Credit: MASEN

But royal decrees only get you so far. Morocco’s renewable energy revolution will ultimately have to survive on market economics. And Rachidi says, so far, the numbers don’t always add up.

“Actually, now we are importing like 16 percent of our needs from Spain because they have overcapacity,” he says, “and sometimes it’s really much cheaper to get electricity in Spain than to produce it in Morocco.”

That kind of competition will help determine whether Morocco’s big bet on concentrated solar power will pay off. Rachidi and others here hope that by 2030, they’ll be able to look back on the Noor plant as the laboratory that made Morocco a solar superpower, and not just an expensive mirage in the desert.