NEW ORLEANS — With power restoration still potentially weeks away for hundreds of thousands of Louisianans, gas shortages brought on by the devastation of Hurricane Ida are sweeping the region, leaving residents hustling for fuel in sweltering conditions.

Tracking service GasBuddy reported that more than half the service stations in both New Orleans and Baton Rouge were out of gasoline Wednesday afternoon. Others could not operate because they lacked electricity to pump gas.

More than 991,000 Louisiana electric customers remained without power Wednesday after the Category 4 storm ravaged the area on Sunday. Its remnants, now a tropical storm, swept through the Mid-Atlantic overnight and caused isolated flooding and at least one death in parts of Maryland and a pocket of power outages in Pennsylvania.

Entergy, Louisiana’s largest utility, reported more than 779,000 of its customers were without power, though it had restored service to 3,500 meters in eastern New Orleans early Wednesday morning. For harder hit parts of the region, company officials said that it could take as much as three weeks for operations to resume and Entergy crews were still working to assess the full extent of the damage.

Residents in those areas are relying on generators to charge cellphones and emergency radios, and to power air conditioning units for relief from the hot and muggy southeastern summer.

The National Weather Service issued a heat advisory for the region from 10 a.m. to 6 p.m., with temperatures forecast to exceed 90 degrees and a 70 percent chance of precipitation later in the day — which could further slow efforts to reconnect the downed power grid.

Entergy said that so far it has tallied damage to 5,112 poles, 5,906 transformers and nearly 62 miles of wires. “As roads clear and we gain access to new parts of our territory, we continue discovering heavy damage to our facilities,” it said in a statement.

In Mississippi, 31,000 meters remain without power, including 10,000 from Entergy and 18,000 from Magnolia Electric. Entergy said service for the majority of the outages should be restored by Thursday night.

Magnolia in a Facebook post gave no indication of where service could return. “The outage is still too big to predict an estimate on when power will be restored or to give any details on specific areas,” the company said.

The Environmental Protection Agency issued emergency waivers Tuesday for both states for provisions of the Clean Air Act to shore up fuel supply lines. Ida knocked out 94 percent of the offshore oil and natural gas production in the Gulf of Mexico, according to the U.S. Department of Energy.

Seven oil refineries in Louisiana accounting for 9 percent of the country’s refinery capacity are shut down, according to federal energy officials, and 278 of 560 offshore oil platforms in the Gulf of Mexico remain evacuated.

Colonial Pipeline, which provides fuel to more than half the East Coast, shuttered portions of its pipeline during the storm as a safety precaution. It restarted operations in those areas on Monday.

The moves are not expected to cause a national fuel shortage, the Department of Energy reported Wednesday, because Gulf Coast crude oil stocks are “essentially in line with the five-year average.” Fuel providers in the region can also shift production away from foreign exports, if necessary, to shore up domestic markets.

Yet gas prices have ticked up steadily, with the national average rising from $3.13 a gallon on Sunday to more than $3.19 by Wednesday, according to GasBuddy.

The shortages have set off tense scenes at service stations around New Orleans. On Tuesday morning, at least 100 cars sat idling along Tchoupitoulas Street in the Lower Garden District in lines at least a half-mile long in each direction outside one gas station.

With the heat index expected to surpass 100 degrees and uncertainty about when power could return, some customers were seen filling multiple gas containers to feed their cars and generators.

Near the front of the line was Mickey Hendricks, who said he had been waiting over an hour to top off his Toyota pickup’s tank and fill up gas cans to keep his generator going at home. “We can last a few days on the generator in this heat, but if we lose that, I don’t know what we’re going to do,” he said.

Hendricks had waited in a line at another gas station Monday when the pumps suddenly went dry. “I hope it lasts,” he said, eying the 15 or so cars ahead of him.

At one point, tempers flared at the station after one customer urged another who was filling up multiple gas cans not to be greedy. As the customers exchanged words, two New Orleans police cars arrived, sirens blaring, and took up positions to monitor the increasingly delicate situation.

Residents in this part of the city remain deeply scarred by memories of Hurricane Katrina. The Shell station sits just blocks from the New Orleans Convention Center, where thousands sought refuge from the floodwaters and heat in the days after the August 2005 storm.

A block away sits a Walmart store that was looted during Katrina. The city seemed determined to avoid a repeat of that melee. On Monday evening, National Guard troops were positioned outside the store, replaced by New Orleans police on Tuesday.

In nearby Arabi, along a stretch of boarded up businesses on St. Claude Avenue, Gerald’s restaurant was up and running on generators, an air-conditioned paradise serving burgers, chicken fingers and doughnuts to sweaty locals.

“Hallelujah! Praise be to Jesus!” a woman shouted, throwing her hands in the air as she walked in the door.

At the counter, a group that included police officers and local residents shared what they were hearing about when the power might come back or where to buy gas.

Down the block, at least 100 cars were lined up on the avenue and through neighborhood streets on rumors a fuel tanker might be refilling the service station soon. A man sat atop his Ford pickup guarding his place at the front of the queue.

“They are lined up on the promise of fuel, just a promise,” said Bobby Daugherty, who said he had queued up earlier but left after a police officer threatened to arrest him and others unless they moved their vehicles.

Daugherty nursed an iced Coca-Cola as he waited for his burger at Gerald’s. At the back door, a line formed at the ATM, one of the only working machines dispensing money in a city where cash is king because of the lack of power.

“Hey, anybody know where you can buy gas?” a man shouted, as he entered the door.

One person said a gas station off Interstate 10 might be working soon. Another suggested there might not be any options until after the Mississippi state line, if they could make it that far.

At the ATM, Margaret Smith was getting cash as she and her sister prepared to evacuate to Biloxi, Miss., because they could not take the heat. She planned to be gone three days — maybe longer. There was a breeze on her porch last night, but inside the house, “It was probably 100 degrees already.”