Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

SAN JUAN, Puerto Rico — Repair crews worked through the night trying to restore electricity to Puerto Rico's 3.5 million people early Thursday after a fire at a power plant blacked out the entire U.S. territory.

Officials said they hoped to restore service by morning, but some schools canceled classes for the day as a precaution. The island's largest public hospital canceled elective surgeries and non-urgent appointments, while government officials and private groups put off dozens of scheduled events.

RELATED: Puerto Rico Blackout Leaves More Than 1 Million without Power

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

The Electric Power Authority said investigators were trying to determine what caused the fire that broke out Wednesday afternoon at a power plant in southern Puerto Rico that serves a majority of customers on the island. The fire began at a switch and caused two transmission lines of 230,000 volts each to fail.

"This is a very serious event," Gov. Alejandro Garcia Padilla said. "The system is not designed to withstand a failure of this magnitude."

The outage was the latest hit for an island mired in a decade-long economic crisis and whose government has warned it is running out of money as it seeks to restructure nearly $70 billion in public debt.

An employee at a fast-food restaurant in a shopping mall uses her mobile phone during a power outage that affected several areas in the country, in San Juan, Puerto Rico, Sept. 21, 2016. Alvin Baez / Reuters

Javier Quintana, the power company's executive director, said he expected most power to be restored by morning. He said airports, hospitals, police stations and water pumping stations would get priority.

Many Puerto Ricans expressed doubts that power would be restored quickly, saying the economic slump has affected basic government services. Hundreds of people took to social media to criticize the Electric Power Authority, noting that they already pay bills on average twice that of the U.S. mainland.

It was unclear how much damage the fire caused or where the power company would obtain the money to repair or buy new equipment. The utility is struggling with a $9 billion debt that it hopes to restructure as it faces numerous corruption allegations. Company officials have said they are seeking more revenue to update what they say is outdated equipment.

The governor, however, said that no amount of money or maintenance would have prevented the fire. He said the switch where the fire began had received proper maintenance.

Authorities said Wednesday's outage caused 15 fires across Puerto Rico as a result of malfunctioning generators, including at the upscale Vanderbilt hotel in the popular tourist area of Condado and at the mayor's office in the northern coastal town of Catano. All those fires were extinguished and no one was injured, officials said.

The blackout knocked out traffic lights, snarling the island's roads. Businesses, universities and government offices closed early, putting even more cars on chaotic roads. Some people opted to not go home and hotels in the capital of San Juan quickly filled up.

As the sun set, people crowded into restaurants running on generators. Others chatted with neighbors while standing or sitting at opened doors and windows trying to beat the hot night.