Oil companies and government officials scrambled Friday to restore fuel deliveries to gas stations in New Jersey and New York as hurricane-related power outages caused widespread fuel shortages and hoarding.

Long lines of irritated, combative customers continued to queue up at fuel stations Friday in the New York metropolitan area, where most stations were closed because of power outages.

Experts say there is plenty of fuel in storage at terminals and even at many stations, but without electricity, fuel cannot be delivered to customers.

"There is no gasoline supply shortage," said Sal Risalvato, executive director of the New Jersey Gasoline-C-Store-Automotive Association. "This is a delivery shortage. You get back electricity, and a large part of this goes away."

He said about 80 percent of the gas stations in northern New Jersey were not operating. Fuel outlets in South Jersey are relatively unaffected.

Sunoco Inc., the Philadelphia retailer, said it had brought more than 350 stations back on line Friday, including all the stations serving the Palisades Parkway and the Garden State Parkway and all but one station on the New Jersey Turnpike.

Government officials tried to restore a sense of order. Homeland Security Secretary Janet Napolitano on Friday temporarily waived a maritime law to allow foreign oil tankers coming from the Gulf of Mexico to enter Northeastern ports to deliver fuel.

Fuel is supplied to the New York area through several sources, including local New Jersey refineries, pipelines connected to refineries in the Gulf of Mexico and Philadelphia, and vessels that bring fuel from overseas or domestic terminals.

The storm disrupted many of those delivery channels. Two refineries in North Jersey that produce 300,000 barrels of fuel a day were knocked out. The New York port was closed. And the Colonial and Buckeye pipelines also halted shipments.

But the biggest culprit appeared to be power outages. With few gas stations able to sell fuel, lines began to form and panic set it.

"You've got social media and crowd behavior at work," said Tom Kloza, the chief analyst for the Oil Price Information Service, who lives in Wall, N.J. "It's nuts. But people are nuts."

The Philadelphia Energy Solutions refinery in South Philadelphia is operating at reduced capacity but expects to resume normal operations this weekend. The Monroe Energy refinery in Trainer and PBF refineries in Paulsboro, Gloucester County, and Delaware City, Del., are operating normally, according to the U.S. Department of Energy.

Sunoco Logistics restarted its Piscataway, N.J., fuel terminal Friday, which is served by the Colonial pipeline, said Joseph F. McGinn, a company spokesman. But its fuel terminals in Newark, N.J., and Inwood, N.Y., were flooded and are likely to remain offline for weeks to undergo repairs.

McGinn said that the company has routed fuel tankers from Baltimore, Philadelphia, South Jersey, and Upstate New York to the New York City area to relieve the shortages.

Contact Andrew Maykuth at 215-854-2947, @Maykuth on Twitter or amaykuth@phillynews.com.