When the heat waves hit Europe this summer, one quiet hero kept the lights — and the air conditioners — on: the sun.

Europe just survived its hottest June on record, with record-breaking heat cooking the continent and a severe drought shriveling its rivers to historic lows. While wind turbines stalled under the stagnant air and nuclear, gas, and coal plants all had to throttle back, solar power did something remarkable. It outperformed normal by 17 percent, and when paired with batteries, it helped keep thousands of air conditioners humming through the brutal afternoons.

Here's what happened. In the United Kingdom, five gas plants cut their output by a combined 2.5 gigawatts because the heat made their cooling systems less effective. At the same time, weak winds nearly halved Britain's typical wind farm generation. In France, warm, low rivers forced the country to lose 18 percent of its nuclear capacity in mid-July. French nuclear plants draw river water in to cool themselves, then release it slightly warmer — but a law caps that discharge temperature to protect fish and other life, so plants must pull back when the intake water is already hot.

Across Europe, dryness pushed the Danube to record lows, exposing WWII shipwrecks and prehistoric relics, while England and Wales recorded their driest July ever. Hydropower hit its lowest July level in a decade.

But solar doesn't need wind or water — just clear skies. And heat waves deliver exactly that. So even as extreme temperatures pushed up Italy's power demand by 28 percent compared with the previous week, and France's by 14 percent, solar panels stepped in to stabilize the grid just when afternoon cooling demand spiked.

The catch is timing. "Temperatures often remain high after sunset and AC demand can stay elevated, even as solar production declines," said Walburga Hemetsberger, CEO of the industry group SolarPower Europe. That's why batteries are becoming crucial — they can hold the day's sunshine and release it into the evening.

There's room for this demand to grow, and fast. Only about a quarter of French households have air conditioning, and about half in Italy and Spain — compared with 90 percent in the United States. Even France's Green party, which long opposed AC over emissions, has shifted. "There are places where we just can't do without it now," said Marine Tondelier, its national secretary, this June.

France's state utility plans to spend over $10 billion over the next 15 years adapting its nuclear and hydropower plants to warmer temperatures and lower water, including new equipment to cool discharged water to environmental standards. But as one study found — the June heat wave that scorched Western Europe was roughly 200 times more likely in today's climate than two decades ago — the bigger lesson may be this: the sun and the battery, working together, are Europe's most dependable summer insurance.