A blackout that affected the entire island of Puerto Rico on Wednesday was caused by a transmission line inadvertently taken out by an excavator, officials said.

The transmission line was accidentally hit with the excavator while a private contractor was working to take out a collapsed tower during ongoing power restoration efforts in the U.S. territory, Justo Gonzalez, executive sub director of Puerto Rico’s Electric Power Authority (PREPA), said.

The region was already suffering from an unstable power grid following Hurricane Maria, which barreled into the island seven months ago.

Officials said earlier Wednesday that it could take 24 to 36 hours to fully restore power.

DOWNED TREE IN PUERTO RICO KNOCKS OUT POWER TO ALMOST A MILLION CUSTOMERS

The first priority for restoration efforts included powering up hospitals, airports, banking centers and water pumping systems, officials said. The island’s largest hospital and main international airport maintained power through backup generators. After that, officials said they would focus on bringing power to businesses and homes.

By the afternoon, power had been restored to five hospitals, Power Authority officials said, including the Cardiovascular Center, the Medical Sciences Campus, the Pediatric Medical Center, the San Pablo Hospital and the El Maestro Hospital.

More than 800,000 people on the island also experienced an outage last week, after a tree collapsed onto a power line.

In a statement from Puerto Rico Gov. Ricardo Rossello, he said PREPA needed to become "a cutting-edge, modern and robust corporation" and suggested that the company cut ties with the contractor responsible for Wednesday's outage.

"Today, the Puerto Rico Electric Power Authority (PREPA) informed that a Cobra subcontractor damaged line 50700 while removing a collapsed tower with an excavator, causing a general power outage on the island," he said. "I have suggested to the PREPA Board of Directors that they cancel the contract with the Cobra subcontractor who is directly responsible for this power outage. This is the second power failure that has affected the people of Puerto Rico in less than a week."

"I am committed to push for and enact trailblazing reforms that will ensure the transformation of our energy sector and give our people a state-of-the-art electric power system as we rebuild a stronger, more resilient Puerto Rico."

Fredyson Martinez, vice president of a union representing power company workers in Puerto Rico, told The Associated Press that the two back-to-back outages were concerning.

"That is not normal," he said.

HURRICANE NAMES HARVEY, IRMA, MARIA AND NATE NOW ‘OFFICIALLY RETIRED’

The outage is not expected to affect a major league baseball game being held on the island tonight, San Juan Mayor Carmen Yulin Cruz said. The emergency systems are functioning properly at Hiram Bithorn stadium, set to host the Cleveland Indians and the Minnesota Twins. And the mayor said extra generators will be brought in and there will be additional security.

This is the first time the island has experienced a full island-wide blackout since the Category 4 storm hit on Sept. 20.

Fox News’ Bryan Llenas and The Associated Press contributed to this report.