WASHINGTON — As Hurricane Irma rampaged through Florida, snapping power lines and damaging vital equipment, it left as many as 15 million people in the state without electricity, the Department of Homeland Security said on Tuesday. While some homes may see power restored within days, utilities said that other customers may have to wait weeks.

“This is going to be a very, very lengthy restoration, arguably the longest and most complex in U.S. history,” Robert Gould, vice president for communications at Florida Power & Light, which supplies electricity to roughly half the state, told ABC News on Sunday.

Why does it take so long?

Repairing the grid after a major hurricane is a complex task, experts said. Utilities first have to send crews out to inspect the damage before they can figure out how best to restore service. That assessment can take days, and heavy flooding and debris from the storm can delay workers trying to reach key areas.

Restoration is not always as simple as replacing wires and poles toppled by high winds or fallen trees. Floods can cause damage to electrical substations that link transmission lines with local distribution lines. Many buildings connected to the grid may also have sustained damage to their electrical systems. Those places need to be identified and isolated from the rest of the network before power starts flowing again, in order to prevent short-circuiting and other safety hazards.