SAN JUAN, Puerto Rico — An island-wide blackout hit Puerto Rico on Wednesday after an excavator accidentally downed a transmission line, officials said, as the U.S. territory struggles to repair an increasingly unstable power grid nearly seven months after Hurricane Maria.

Officials said it could take 24 to 36 hours to fully restore power to more than 1.4 million customers as outrage grew across the island about the state of Puerto Rico’s Electric Power Authority. It was the second major failure in less than a week, with the previous one affecting some 840,000 customers.

Several large power failures have hit Puerto Rico in recent months, but Wednesday was the first time since the hurricane struck Sept. 20 that the U.S. territory has experienced a full island-wide blackout.

The outage snarled traffic across the island, interrupted classes and work, and forced dozens of businesses to temporarily close, including the largest mall and popular tourist attractions like a 16th century fort in the historic part of Puerto Rico’s capital. Long lines formed at gas stations across the island, while authorities offered assurances that there was enough gasoline available.

Backup generators roared to life at the island’s largest public hospital and at its main international airport, where officials reported no cancellations or delays. Meanwhile, the power company said its own customer service center was out of service and asked people to go online or use the phone.

Officials said restoring power to hospitals, airports, banking centers and water pumping systems was their priority. Following that would be businesses and then homes.

By late in the afternoon, power had returned to several hospitals and at least five of 78 municipalities.