Come hell or high water — and Sandy brought both to many Americans— most of us can’t get the electricity we need. More than two weeks after the storm’s departure, 25,000 homes were still without power. We live high in the Rockies and were unaffected, but a couple of Februaries ago snowstorms knocked out our neighbors’ electricity on five different days. But ours stayed on — by design. Our house’s efficient lights and appliances save most of the electricity. This shrinks the solar power system that runs our meter backwards and sells back its surplus to the grid. But unlike most solar-powered buildings, ours is wired to work with or without the grid.

That’s where the Pentagon is headed with its own power supplies. Warfighters need their stuff to work. They’ve concluded that the vulnerability of the commercial power grid is far too great to ensure mission continuity. So they’re switching to efficient use, distributed and often renewable energy sources on or near their bases, and reorganizing their wiring into “microgrids.” These neighborhood power systems normally interconnect with the larger grid around them, but can stand alone as needed, disconnecting fractally and reconnecting seamlessly.

The rest of us, whom our military defends, need our stuff to work too, so we should follow their example. Twenty-odd microgrid experiments around the world show that this concept works. By my accounting, a resilient, microgrid-based, and 80%-renewable electricity system would cost about the same as business-as-usual, greatly strengthening national and family security as a free bonus.

Such resilient grid design would protect us all from cascading and potentially economy-shattering blackouts that could make Sandy look trivial. Earthquakes, superstorms, floods, and wildfires are the least of our worries. Solar storms make massive grid failures inevitable — the only question is when, and it’s about time for another big one. A simple acts of terrorism could black out a city for months. A concerted cyberattack launched anonymously from anywhere on earth could physically destroy key grid assets across much or all of the country, returning America instantly to the seventh century, with dim prospects for recovery.

The solution is in our hands, and it’s proven. When wildfire cut a major power line, the University of California at San Diego’s microgrid switched from importing to exporting power from its onsite sources in less than a half-hour. Denmark is reorganizing its grid in “cellular” fashion, stress-testing annually by cutting off the grid to make sure each “cell” still meets vital loads. Prof. Rikiya Abe at Tokyo University has even invented a “digital grid” whose “routers” can exchange power between microgrids without needing to run in lockstep like today’s analog grid.

Perhaps the most impressive example of electrical resilience comes from Cuba, and we can learn from it even if we wouldn’t want to live there. Cuba’s Soviet-era grid was highly centralized and depended on 11 big but geriatric power plants, so in 2005, Cuba suffered 224 serious blackout days. But this fell in 2006 to three and in 2007 to zero. How? By adopting efficient appliances, inverted rate structures, public education, distributed generators, and optionally independent microgrids. Then in 2008, two hurricanes in two weeks shredded Cuba’s eastern grid, but essential services were maintained.

A U.S. industry consensus standard called IEEE-1547 specifies how to wire renewable and other distributed generators to keep utility workers safe while ensuring resilient, uninterruptible power supplies for customers. Yet many states or utilities still don’t allow this. Modern solar power electronics often offer IEEE-1547-compliant resilient operation, but obsolete rules don’t allow this smart feature to be activated. State utility regulators should fix this now.

The sooner resilient grid architecture becomes standard practice, the better we can keep the lights on, the economy humming, and blackouts just a bad old memory.