The story of how Texas was brought to its knees by crippling cold weather leaving millions without power is a complex one, yet entirely predictable and avoidable.

The details matter, so it is important to know the long story, but let’s start with the short version: For years, Texas’ grid operator (ERCOT) has overestimated the ability to maintain a reliable grid without a sufficient supply buffer, known as a “reserve margin.” That margin is the difference between demand for electricity and what the grid can produce. When demand exceeds production, you get blackouts. That buffer has been shrinking because reliable sources of energy have been retired, few reliable plants have been constructed, and the grid is depending more and more on weather-dependent renewable energy that repeatedly fails to perform when we need it most.

When wind and solar production predictably dropped as the winter storm hit, the buffer collapsed. ERCOT needed to execute a series of balancing measures that would have protected the grid. But it did not act soon enough, which caused many more gas and some coal power plants in the system to “trip.” (Think of it as a circuit breaker that triggers to prevent a fire or other emergency at your house when there is a system imbalance.) Other weather-related issues caused problems too but ERCOT’s failure to act sooner was a major factor.

Usually, a system trip wouldn’t last long and we’d have power back in a few hours. But this time, many of the units that were tripped off the system had difficulty coming back online for a variety of reasons, including the fact that some were not designed to be taken off and put back on the system quickly, as well as other cold weather issues that exacerbated the problem.

So when people blame ERCOT for not acting quickly, they’re right. And so are the people who say that both renewable energy and fossil energy plants are not generating what they should. But it doesn’t begin there. Our overdependence on unreliable energy that caused the razor thin reserve margins started the ball rolling years ago.

Here’s the long story.

Keeping the power on is a bit of a guessing game played out every day by the grid operator to make sure we have the right mix of energy getting on to the grid. There’s that buffer, the reserve margin, which ERCOT uses to give it some leeway in making moves. As with anything, the more reliable and predictable the source of energy, the better moves ERCOT can make.

However, the race to add in renewables pushed out more reliable forms of energy and kept new reliable energy from being built. That resulted in the buffer in our electric grid being stripped out—going from more than a 20% surplus years ago to single digits in the last couple of years.

Without that buffer, our system has become much more vulnerable to outages when we see extreme heat or extreme cold. The problem is made worse by the fact that renewables have grown to become a significant percentage of our fleet, making our power grid much more susceptible to weather-related shortages. That is because renewables do not show up when we need power the most (high heat, freezing cold, big storms, etc.)

For example, starting on Sunday night through Wednesday, our nearly 32,000 MWs of installed wind capacity was delivering less than 10% of that capacity and, for several key hours of this event, less than 3% of that capacity. Since the blackouts started at night, solar energy wasn’t going to be any help. Still, by mid-day Monday it was only producing about half of its 5,700 MW of installed solar capacity.

On Valentine’s Day, the lack of buffer and predictable failure of wind and solar had ERCOT on alert to do what all system operators do when they anticipate razor-thin reserve margins—they start to implement rolling, temporary outages across the system to keep the level of demand in balance with the level of supply.

This practice of bringing parts of the grid down and back up again in series has been done before, often, and across the country, with success. When done properly, brief power outages are little more than an inconvenience and normalcy is quickly restored. What happened late Sunday night and early Monday morning was that ERCOT waited too long to commence this balancing activity. Add to that some other, not-yet-fully-understood interruptions, the result was an imbalance in the grid that “tripped” large numbers of previously operating gas and coal plants off the system. While technically complex, this “tripping” phenomenon occurs when the system operator allows voltage and frequency in the transmission system to drop too dramatically, thereby triggering safety equipment at the power plants to “trip” off to avoid destroying equipment with an overload.

Because of ERCOT’s errors, among those losing power were many of Texas’ natural gas producers in the Permian Basin, which were then unable to continue providing fuel for the grid, potentially exacerbating the problem.

To be clear, if the Texas grid had more reliable energy available, ERCOT would never have had to start implementing rolling outages. The mistakes it made in not starting soon enough and then subsequently making poor judgments about how to fix the problems they caused would never have happened had we not allowed our system to grow too unreliable to begin with.

Because of the severe cold, when a large number of gas and coal plants were tripped off the system, many had difficulty coming back online. This is a common problem with all power plants—other than a subset of smaller “quick-start plants,” most plants are designed to be running and online all the time. So restarting them takes time, even when the weather is good. On Monday morning, when we had single-digit temperatures and below-zero wind chills (which have persisted to keep things frozen throughout the week), a long list of complications hit the power plants—ranging from frozen gas lines to interrupted gas service to frozen pipes and other equipment. We may find that some of those failures occurred before the “trips,” but the majority of the problems experienced occurred afterward, once the plants went cold because of ERCOT’s mistakes.

Renewables were the dominant factor in why Texas got into this situation to begin with, which led to the need for action by ERCOT, their resulting mistakes, and the problems with getting coal and gas back online. Just pointing the finger at downed gas plants is a bit like steadily replacing the bricks holding your house up with straw and masking tape, and then blaming the chimney when the whole thing collapses.

A final thought: Power plants that use gas, coal and nuclear energy have proven to have extremely high reliability and availability factors (over 99%) over peak conditions in Texas for the past several years. Although extreme cold is more of a challenge for these units than our normal peak—extreme heat—they are still a proven reliable source of energy across the northern parts of our country and across the globe that experience much colder temperatures than we did this week.

Many weatherization improvements were made to the Texas fleet after a 2011 winter peak, and it may be that additional weatherization is called for based on the experiences of this week.

But it is critically important to understand that never before have so many of the Texas units been subjected to the mistakes ERCOT made on February 14-15, which undermined their ability to stay online and to maintain reliable energy’s stellar performance record during peak conditions.

The lessons learned from this utterly predictable episode may lead to more winterization efforts. But we can’t forget that we got here through years of adding unreliable power to the grid, reducing the margin of error for mistakes, and undercutting access to reliable energy.