HOUSTON – When OPEC banned oil exports to the United States in 1973 and created long gasoline lines, President Richard Nixon promised an effort that would combine the spirit of the Apollo program and the determination of the Manhattan Project.

“By the end of this decade we will have developed the potential to meet our own energy needs without being dependent on foreign energy sources,” he said in a televised address.

Its timing was wrong – it took more than 40 years – but the country has come pretty close to energy independence in recent years thanks to an increase in domestic shale oil and natural gas production and the use of solar and wind power.

However, this independence is fragile. Cars lined up at gas stations in much of the Southeast last week after the colonial pipeline was paralyzed by a cyber attack by a criminal group seeking a ransom. The power grid is also under greater strain from climate change. Last year, a heat wave in California and a freezing state in Texas forced rolling blackouts as demand for electricity exceeded supply.

“Eight presidents wanted energy independence, and now that we have achieved that, we are more resilient to the global oil market,” said Daniel Yergin, energy historian and author of The New Map: Energy, Climate and the Clash of Nations. ”” However, resilience is still a question of how the system works under stress, whether it’s pipelines or electricity. “

The colonial pipeline disruption had nothing to do with turbulence in the Middle East or insufficient American power generation. Nonetheless, panic buying, which had seldom been seen for decades, led to bottlenecks, and pump prices rose by up to 20 cents per gallon for regular gas in a few days, according to the AAA.

Mr. Yergin said drivers who lined up at pumps to fill gas cans and even plastic bags made the situation worse. The impulse to hoard stems from the oil shocks of the 1970s and seemed to touch a chord in the national psyche.

“People remembered gas pipes even though they weren’t born yet,” said Yergin.

Colonial Pipeline, a privately held company, resumed full operations over the weekend, but it will be a few more days before many gas stations are refilled.

Energy companies are under increasing pressure from governments and investors to strengthen their defenses against cyberattacks, but these and other vulnerabilities will not be easy to overcome, especially after years of underinvestment.

In the case of networks in California and Texas, there are few simple solutions to the weaknesses exposed by heat waves and freezing temperatures that are costing these states billions of dollars and leaving many dead and thousands homeless. That the country’s two most populous states have been located low suggests that power plants and electrical lines are unprepared for the extreme weather events that climatologists say will happen in the coming years due to the build-up of gases that warm the planet, will be more common in the atmosphere.

Nationwide, weather-related power outages have risen by two thirds since 2000, according to the Ministry of Energy.

“Our traditional strategies for generating and delivering energy are threatened by the climate and cyber terrorists,” said Mark Brownstein, senior vice president, Environmental Defense Fund. “On the way to a cleaner and more sustainable energy future, we must also move towards a future that is fundamentally more resilient.”

Upgrading the energy system will not be easy. Dozens of competing companies operating a vast network of oil and gas wells, pumping stations, transmission lines, and power plants need to be persuaded to make their operations more resilient to weather and criminal attack. Significant resources must be made available by companies, government agencies and research to stay one step ahead of cybercriminals. President Biden’s $ 2 trillion infrastructure plan provides $ 100 billion for the transmission network.

The pursuit of energy independence has never been in a straight line, and there have been many unfortunate twists and turns. Reliance on Middle Eastern oil has been a major consideration in military action and diplomatic strategy, including alliances with countries like Saudi Arabia with disruptive human rights records. Half a century ago, the country switched from burning fuel oil to becoming more dependent on coal, which contributed to climate change.

The search for energy independence also led to innovations. Fracking – the hydraulic fracturing of shale oil and natural gas – not only reduced energy imports, but also made the United States a major exporter. Suddenly, oil and gas were no longer a national security hole, but a tool for advancing American interests.

For the past 15 years, US oil and gas production has kept energy prices down at home and abroad and strengthened the global economy. By exporting energy, Washington has been able to compete with Russian gas supplies to Europe, help allies like Japan, who import a lot of energy, and block Iranian and Venezuelan oil supplies.

In a twist, the shale boom also made some parts of the United States more vulnerable. In recent years, half a dozen refineries along the east coast have closed because they could not compete with more advanced refineries on the Gulf Coast that benefited from cheap and abundant oil and gas in Texas. The rivers on the Colonial Pipeline, which connects the Gulf Refineries to New Jersey, grew steadily, supplying nearly half of the region’s fuel needs.

When hurricanes hit and Gulf refineries shut down, gasoline and diesel prices tend to rise on the east coast. Usually this is not a huge problem as companies store a lot of fuel near where it is used and trucks and barges can usually make the difference. This time, however, uncertainty about how long it would take to restore supplies made the colonial pipeline shutdown much more disruptive.

The ransomware attack was the work of DarkSide, an extortionate ring that was responsible for numerous attacks on companies in several countries. But it is hardly the only group that infiltrates computer systems in order to extort money. Others have names like REvil, Maze, and LockBit.

“Technology is moving so fast that you fix a potential vulnerability or two or twenty in your computer systems and the hackers find another way to get in.” said Drue Pearce, a former assistant administrator for the Federal Pipeline Hazardous Materials Safety Administration.

The criminal groups pose a threat to industries beyond energy. However, experts say that energy is of particular concern as it is essential for a functioning economy. The threat is no less complex than reducing the United States’ dependence on foreign oil, said Bill Richardson, a former energy secretary.

“This is a new threat that we are not prepared for,” he said.