Prince Turki bin Saud bin Mohammad Al Saud belongs to the family that rules Saudi Arabia. He wears a white thawb and ghutra, the traditional robe and headdress of Arab men, and he has a cavernous office hung with portraits of three Saudi royals. When I visited him in Riyadh this spring, a waiter poured tea and subordinates took notes as Turki spoke. Everything about the man seemed to suggest Western notions of a complacent functionary in a complacent, oil-rich kingdom.

But Turki doesn’t fit the stereotype, and neither does his country. Quietly, the prince is helping Saudi Arabia—the quintessential petrostate—prepare to make what could be one of the world’s biggest investments in solar power.

Near Riyadh, the government is preparing to build a commercial-scale solar-panel factory. On the Persian Gulf coast, another factory is about to begin producing large quantities of polysilicon, a material used to make solar cells. And next year, the two state-owned companies that control the energy sector—Saudi Aramco, the world’s biggest oil company, and the Saudi Electricity Company, the kingdom’s main power producer—plan to jointly break ground on about 10 solar projects around the country.

Turki heads two Saudi entities that are pushing solar hard: the King Abdulaziz City for Science and Technology, a national research-and-development agency based in Riyadh, and Taqnia, a state-owned company that has made several investments in renewable energy and is looking to make more. “We have a clear interest in solar energy,” Turki told me. “And it will soon be expanding exponentially in the kingdom.”

Such talk sounds revolutionary in Saudi Arabia, for decades a poster child for fossil-fuel waste. The government sells gasoline to consumers for about 50 cents a gallon and electricity for as little as 1 cent a kilowatt-hour, a fraction of the lowest prices in the United States. As a result, the highways buzz with Cadillacs, Lincolns, and monster SUVs; few buildings have insulation; and people keep their home air conditioners running—often at temperatures that require sweaters—even when they go on vacation.

The skyline in Riyadh is a striking reminder of Saudi Arabia’s rapid growth and urbanization. In 1960, the city had just 155,000 inhabitants; today it has more than 5 million. (Mohammed Al-Deghaishim)

Saudi Arabia produces much of its electricity by burning oil, a practice that most countries abandoned long ago, reasoning that they could use coal and natural gas instead and save oil for transportation, an application for which there is no mainstream alternative. Most of Saudi Arabia’s power plants are colossally inefficient, as are its air conditioners, which consumed 70 percent of the kingdom’s electricity in 2013. Although the kingdom has just 30 million people, it is the world’s sixth-largest consumer of oil.

Now, Saudi rulers say, things must change. Their motivation isn’t concern about global warming; the last thing they want is an end to the fossil-fuel era. Quite the contrary: they see investing in solar energy as a way to remain a global oil power.

The Saudis burn about a quarter of the oil they produce—and their domestic consumption has been rising at an alarming 7 percent a year, nearly three times the rate of population growth. According to a widely read December 2011 report by Chatham House, a British think tank, if this trend continues, domestic consumption could eat into Saudi oil exports by 2021 and render the kingdom a net oil importer by 2038.

That outcome would be cataclysmic for Saudi Arabia. The kingdom’s political stability has long rested on the “ruling bargain,” whereby the royal family provides citizens, who pay no personal income taxes, with extensive social services funded by oil exports. Left unchecked, domestic consumption could also limit the nation’s ability to moderate global oil prices through its swing reserve—the extra petroleum it can pump to meet spikes in global demand. If Saudi rulers want to maintain control at home and preserve their power on the world stage, they must find a way to use less oil.

Solar, they have decided, is an obvious alternative. In addition to having some of the world’s richest oil fields, Saudi Arabia also has some of the world’s most intense sunlight. (On a map showing levels of solar radiation, with the sunniest areas colored deep red, the kingdom is as blood-red as a raw steak.) Saudi Arabia also has vast expanses of open desert seemingly tailor-made for solar-panel arrays.

Solar-energy prices have fallen by about 80 percent in the past few years, due to a rapid increase in the number of Chinese factories cranking out inexpensive solar panels, more-efficient solar technology, and mounting interest by large investors in bankrolling solar projects. Three years ago, Saudi Arabia announced a goal of building, by 2032, 41 gigawatts of solar capacity, slightly more than the world leader, Germany, has today. According to one estimate, that would be enough to meet about 20 percent of the kingdom’s projected electricity needs—an aggressive target, given that solar today supplies virtually none of Saudi Arabia’s energy and, as of 2012, less than 1 percent of the world’s.

Some of Saudi Arabia’s most prominent industrial firms, as well as international electricity producers and solar companies big and small, have lined up to profit from what they see as a major new market. The fact that Saudi Arabia, an ardent booster of fossil fuels, has found compelling economic reasons to bet on solar is one of the clearest signs yet that solar, at least in some cases, has become a cost-effective source of power.

But the Saudis’ grand plan has been slow to materialize. The reasons include bureaucratic infighting; technical hurdles, notably dust storms and sandstorms that can quickly slash the amount of electricity a solar panel produces; and, most important, the petroleum subsidies that shield Saudi consumers from any real pressure to use less oil. The kingdom is a fossil-fuel supertanker, and though the captain knows that dangerous seas lie ahead, changing course is proving exceedingly hard.

Nasser Qahtani is an oilman through and through. On a credenza in his Riyadh office, he has a souvenir glass block that holds a shot of crude from Saudi Arabia’s biggest oil field. He spent about 15 years working at an Aramco petroleum-processing plant. And he has a master’s degree from Texas A&M University, which is why he has two Aggies coffee mugs on his bookshelf. “That’s for my easy days,” he told me one morning, pointing to the smaller one. “That’s for my tough days,” he deadpanned, pointing to the bigger mug.

Mohammed Al-Deghaishim

Nasser has many tough days. Any shift away from oil threatens a host of entrenched powers, and as the vice governor of regulatory affairs for Saudi Arabia’s Electricity & Cogeneration Regulatory Authority, he spends much of his time trying to corral the competing constituencies to work together to modernize the country’s energy system.

Sipping Arabic coffee while sitting beneath paintings of the same three Saudi royals who adorned Prince Turki’s office wall, Nasser underscored the extent to which his country’s energy subsidies promote waste. In October, the World Bank estimated that Saudi Arabia spends more than 10 percent of its GDP on these subsidies. That comes to about $80 billion a year—more than a third of the kingdom’s budget. “In my opinion, that’s an accurate number,” Nasser said. “This is not sustainable.”

Also unsustainable is the opportunity cost of burning so much oil at home. Aramco sells oil to the Saudi Electricity Company for about $4 a barrel, roughly the cost of production. Even with the global price of oil down to about $60 a barrel as of this writing (a drop of about 40 percent since June 2014), Saudi Arabia forgoes some $56 on every barrel it uses at home. That gap will become far greater if, as many experts expect, the global price rebounds.

Saudi leaders carefully calibrate the kingdom’s output to keep that global price where they want it: high enough to fill Saudi coffers but low enough to avoid spurring competitive threats. For years, analysts have debated how much oil Saudi Arabia has in the ground, with some alleging that the kingdom is far less flush than it lets on. Saudi officials maintain that they face no immediate crisis, but they talk about the need to keep in check competitors such as the U.S. shale-oil industry. A serious reduction in the oil they have available for export would hinder their ability to fend off such threats.

Over roughly the past year, the government has toughened energy-efficiency requirements for air conditioners, imposed the country’s first-ever fuel-economy standards for cars, and begun to require insulation in new buildings. It’s moving to require that new power plants be more efficient than the ones they replace. And in March, Saudi Arabia signed a memorandum of understanding with South Korea to build the kingdom’s first two nuclear reactors, and possibly more.

Mohammed Al-Deghaishim

What Saudi leaders don’t appear likely to do, at least anytime soon, is cut the fossil-fuel subsidies. Many Saudis view cheap energy as a birthright, and any increase in prices would be hugely unpopular. In a speech in February, the head of the central bank called for slowly reforming the subsidies, but he gave no indication of when. In the meantime, officials are looking to what once seemed an unthinkable solution: promoting renewable energy.

“The view initially was not to support renewables,” Nasser told me, explaining that Saudi officials feared “that if renewables were successful, we would not find customers for our commodity.” That view has changed—sort of. Should solar somehow begin to threaten the primary market for Saudi oil—as a transportation fuel—the kingdom’s calculus could shift back.

Few places better illustrate Saudi Arabia’s energy challenge than the country’s Red Sea coast. Along a stretch of black highway running north from the coastal city of Jeddah lies a string of new infrastructure. All of it is big. All of it is named for King Abdullah bin Abdulaziz al Saud, who died in January after leading the country for a decade. And much of it was built by Aramco, which, beyond being an international oil giant, is the Saudi government’s go-to player for getting things done. There’s the new King Abdullah Football Stadium, the new King Abdullah University of Science and Technology, the new King Abdullah Economic City, and the new King Abdullah Port. To the north of all this development, in the village of Rabigh, sits an enabler of growth: a massive, oil-fueled power plant.

Built by a Chinese firm and completed in 2012, the plant consists of two towering furnaces that produce electricity by burning heavy fuel oil. When I visited one morning this spring, a tanker sat at the pier, disgorging its liquid into one of the plant’s six circular storage tanks. Each tank holds about 14.5 million gallons of oil, which the plant typically burns in a week. In the sweltering air, the place stank like a Jiffy Lube, the kind of smell that sinks into your pores. Luai Al-Shalabi, a worker who lives in a dormitory there, told me the oily odor is ever-present: “All the time I feel it.”

Oil isn’t the only liquid this plant requires. It also needs freshwater—more than half a million gallons a day. The plant’s furnaces burn the oil, the heat boils the water, and the steam spins the plant’s turbines. All of that freshwater isn’t readily available in this desert kingdom; the Saudis have to make much of it out of saltwater.

Next to the power plant is a desalination plant. It’s small by Saudi standards; far bigger ones produce drinking water. Yet it still seems huge: a maze of tanks, tubes, filters, and pumps covering an area twice as large as a football field. The water the plant sucks in from the Red Sea contains about 40,000 parts per million of salt. By the time it comes out the other end, having been filtered and mixed with chemicals, its salt content is 25 parts per million. The process is a triumph of man over nature. And every step consumes electricity—which comes primarily from oil.

Georg Eitelhuber came to Saudi Arabia to teach high-school physics. A few years ago, he began developing a system to keep solar panels clean in the desert. (Mohammed Al-Deghaishim)

Solar power presents an alluring alternative. The kingdom first began experimenting with energy from the sun in the 1970s. In 1979, the same year that unrest in the Middle East sparked a global oil shock and President Jimmy Carter had solar panels installed on the White House roof, the United States and Saudi Arabia jointly launched a solar-research station about 30 miles northwest of Riyadh, in a tiny village called Al-Uyaynah, which at the time lacked electricity.

Work at this site languished in the 1990s and early 2000s but has picked up in the past few years. In 2010, the King Abdulaziz City for Science and Technology, the research agency that runs the station, built a small experimental assembly line there to manufacture solar panels. A year later, it more than quadrupled the line’s capacity. It plans to expand the facility again over the next several months, this time by a factor of eight.

Prince Turki told me that Saudi officials want to add another factory elsewhere in the kingdom; it will be one of the largest outside of China. The goal, he said, is not just to install solar panels across Saudi Arabia but to export them—a way, Saudi officials hope, to create high-paying tech jobs for the kingdom’s large population of young people. (Some two-thirds of Saudis are younger than 30.) Officials also want to bankroll solar installations in other countries, to boost the market for Saudi-made panels. Among the potential locations is the United States, where Turki envisions the kingdom undercutting other solar providers in part by tapping cheap development loans from Saudi banks.

But the factory at Al-Uyaynah shows how far the country has to go. The equipment comes mostly from Europe, and the solar cells—the square slices of silicon that make up a solar panel—are made in Taiwan. Often, as on the day I visited, the assembly line doesn’t produce much, because materials are stuck in transit. Once, a shipment of the plastic sheeting used to seal the backs of solar panels sat at a Saudi port for a month, and it melted.

Mohammed Al-Deghaishim

The disconnect between aspiration and reality is even starker at the King Abdullah University of Science and Technology, one of the big projects along the Red Sea coast. The multibillion-dollar campus has both a world-class solar-research lab and some stupendously energy-inefficient amenities—including, in the middle of the desert, a hotel where I found my room chilled to about 62 degrees Fahrenheit and a nine-hole golf course fully lit for nighttime play.

The entire campus went up in about three years. It has a town square with a Quiznos sandwich shop, a Burger King, and a grocery store with an extensive selection of dates and nonalcoholic beer, all across the street from a towering white mosque. It has steel-and-wood offices and houses with red-tile roofs, both of which evoke suburban California. And it has a faculty of experts recruited from around the world.

Among them is Marc Vermeersch, a Belgian physicist and materials scientist who arrived in January after spending several years in Paris heading up solar work at Total, the French oil giant. Vermeersch told me that although no expense was spared in setting up the university’s solar laboratory, the money wasn’t wisely spent. The lab includes half a dozen highly specialized printers—including one that cost about $1 million—that apply coatings to surfaces, a process important in researching futuristic solar-panel technologies. But because Saudi Arabia wants to ramp up solar power soon, Vermeersch and his colleagues are reconfiguring the lab to focus on nearer-term research, work he hopes will pay off in the next few years.

The university houses an incubator for technology start-ups, including a firm founded on the premise that there’s good money to be made in keeping solar panels clean in the desert. The company’s creator is Georg Eitelhuber, an Australian-born mechanical engineer who came to the university in 2009, the year it opened, to teach physics at a high school on the campus. “King Abdullah made me an offer I couldn’t refuse,” Eitelhuber told me kiddingly, in an Aussie accent.

In late 2010, Eitelhuber attended a ceremony at the university for which “a bunch of bigwig managers” gathered to christen experimental solar panels. But a dust storm had blown in, covering the panels and threatening to nix the photo op. With the temperature hovering at about 115 degrees and “everyone sweating bullets,” he said, “guys with squeegees” swept in to wash down the panels. Incredulous, Eitelhuber asked how solar panels are normally cleaned. “This is it,” he was told. “It was clear to me this was going to be the big new problem of a new industry in the Middle East.”

With seed funding from the university, he and some colleagues set about designing a waterless system. “The idea of using desalinated water that’s desalinated using oil,” he said, “is just a big green wash.” Five years later, his company has a late-stage prototype—a long metal rod with lines of brush bristles, powered by the panels—and several solar-panel manufacturers are testing the device. Eitelhuber plans to start installing it on solar farms next year.

Aramco is the most important player in the kingdom’s shift to solar power. The company’s initial forays have been tiny—a solar-panel array next to one of its office buildings, for example—but its plan to break ground on 10 or so bigger solar projects next year seems to represent the start of a more serious commitment. A high-ranking Saudi official told me he expects Saudi Arabia to develop an initial tranche of a few gigawatts of solar capacity over the next five years. The projects will be in places where the cost of conventional fuel is high, either because the sites are remote or because they use diesel. (Saudi Arabia has historically had to buy large quantities of diesel at international prices because its refineries can’t process enough to satisfy domestic demand.)

Even at these cherry-picked sites, solar power is likely to cost more than electricity from the existing conventional plants—but only because those conventional plants get oil at a subsidized price. This explains why the government, not the private sector, is making most of the investment in solar. Private companies are waiting for the government to offer up a slate of contracts that would, in effect, allow solar energy to compete with artificially cheap oil-fired electricity.

Prince Turki bin Saud bin Mohammad Al Saud is helping to lead the kingdom’s shift to solar power. (Mohammed Al-Deghaishim)

One of the biggest firms waiting in the wings is Acwa Power International, which is based in Riyadh and owns and operates power and desalination plants in the Middle East, Africa, and Southeast Asia. In the past few years, Acwa Power has signed contracts to produce solar power in several countries—places where the price of conventional electricity is higher than in Saudi Arabia.

Earlier this year, it won a bid to build a solar farm in Dubai. The price at which Acwa Power agreed to sell electricity from that solar farm—5.84 cents a kilowatt-hour—turned heads among solar watchers the world over. It was heralded as signaling a new era of cost competitiveness. Paddy Padmanathan, Acwa Power’s president and CEO, told me he’s confident the company will make a healthy profit over the 25 years of the deal. “All of a sudden, renewables are becoming a very competitive proposition,” he said.

Acwa Power hasn’t yet developed any solar projects in Saudi Arabia. But Prince Turki told me that Taqnia, the state-owned company he chairs, is finalizing a deal to provide solar energy to the Saudi Electricity Company for 5 cents a kilowatt-hour—even less than the price Acwa Power recently agreed to in Dubai. “It’s the cheapest in the world that I know of,” Turki said.

That deal may be a tantalizing sign of things to come, but the goal Saudi Arabia announced three years ago of building 41 gigawatts of solar capacity remains a distant glimmer. In January, Saudi officials announced that they were pushing back the target date from 2032 to 2040—and even with the longer time frame, skeptics have dismissed the goal as a mirage.

Proving them wrong would require reshuffling an economic deck that the kingdom’s leaders have stacked for decades to favor petroleum. In that sense, Saudi Arabia’s energy challenge is a more extreme version of the one that faces the rest of the world. But if the kingdom’s leaders can find the political courage to act decisively, Saudi Arabia, of all nations, could become a model for other countries trying to shift away from oil.